In order to successfully complete this assignment you need to participate both individually and in groups during class. If you attend class in-person then have one of the instructors check your notebook and sign you out before leaving class. If you are attending asyncronously, turn in your assignment using D2L no later than 11:59pm on the day of class. See links at the end of this document for access to the class timeline for your section.
Image from: https://www.wikipedia.org/
An inner product on a real vector space $V$ is a function that associates a number, denoted as $\langle u,v \rangle$, with each pair of vectors $u$ and $v$ of $V$. This function satisfies the following conditions for vectors $u, v, w$ and scalar $c$:
$$\langle u,v \rangle = \langle v,u \rangle \text{ symmetry axiom}$$ $$\langle u+v,w \rangle = \langle u,w \rangle + \langle v,w \rangle \text{ additive axiom}$$ $$\langle cu,v \rangle = c\langle v,u \rangle \text{ homogeneity axiom}$$ $$\langle u,v \rangle = \langle v,u \rangle \text{ Symmetry axiom}$$ $$\langle u,u \rangle \ge 0 \text{ and } \langle u,u \rangle = 0 \text{ if and only if } u = 0 \text{ positive definite axiom}$$The dot product of $R^n$ is an inner product. However, we can define many other inner products.
Let $V$ be an inner product space. The norm of a vector $v$ is denoted $\lVert v \rVert$ and is defined by:
$$\lVert v \rVert = \sqrt{\langle v,v \rangle}$$Let $V$ be a real inner product space. The angle $\theta$ between two nonzero vectors $u$ and $v$ in $V$ is given by:
$$cos(\theta) = \frac{\langle u,v \rangle}{\lVert u \rVert \lVert v \rVert}$$Let $V$ be an inner product space. Two vectors $u$ and $v$ in $V$ are orthogonal if their inner product is zero:
$$\langle u,v \rangle = 0$$Let $V$ be an inner product space. The distance between two vectors (points) $u$ and $v$ in $V$ is denoted $d(u,v)$ and is defined by:
$$d(u,v) = \lVert u-v \rVert = \sqrt{\langle u-v, u-v \rangle}$$Consider the following pseudo inner-product which is used to model special relativity in $R^4$:
$$\langle X,Y \rangle = -x_1y_1 - x_2y_2 -x_3y_3 + x_4y_4$$It has the following norms and distances:
$$\lVert X \rVert = \sqrt{|\langle X,X \rangle|}$$$$ d(X,Y) = \lVert X - Y \rVert = \lVert ( x_1 - y_1, x_2-y_2, x_3 - y_3, x_4 - y_4) \rVert$$$$ = \sqrt{|-(x_1 - y_1)^2 - (x_2-y_2)^2 - (x_3 - y_3)^2 + (x_4 - y_4)^2|}$$✅**QUESTION:** The Minkowski Geometry is called pseudo inner product because it violates one of the inner product axioms. Discuss the axioms in your group and decide which one it violates.
Put your answer to the above quesiton here
The distance between two points on the path of an observer in Minkowski geometry corresponds to the time recorded by that observer in traveling between the two points.
We assume that Alpha Centauri lies in the $x_1$ direction from the Earch. The twin on Earth advances in time $x_4$. There is no motion in either the $x_2$ or $x_3$ directions. Twin 2 on board the rocket advances in time and moves toward Alpha Centauri and back to the Earth.
Let $P=(0,0,0,0)$, $R=(4,0,0,5)$, and $Q=(0,0,0,10)$.
✅**QUESTION:** The star cluster Pleiades in the constellation Taurus is 410 light years from Earth. A generational spaceship to the cluster traveling at constant speed ages 850 years on a round trip. By the time the spaceship returns to Earth, how many centuries will have passed on Earth?
Put your answer to the above quesiton here
✅**QUESTION:** How fast was the spaceship going relative to earth?
Put your answer to the above question here.
Definition: Let $C[a,b]$ be a vector space of all possible continuous functions over the interval $[a,b]$ with inner product: $$\langle f,g \rangle = \int_a^b f(x)g(x) dx.$$
Now let $f$ be an element of $C[a,b]$, and $W$ be a subspace of $C[a,b]$. The function $g \in W$ such that $\int_a^b \left[ f(x) - g(x) \right]^2 dx$ is a minimum is called the least-squares approximation to $f$.
The least-squares approximation to $f$ in the subspace $W$ can be calculated as the projection of $f$ onto $W$:
$$g = proj_Wf$$
If $\{g_1, \ldots, g_n\}$ is an orthonormal basis for $W$, we can replace the dot product of $R^n$ by an inner product of the function space and get:
$$prog_Wf = \langle f,g_1 \rangle g_1 + \ldots + \langle f,g_n \rangle g_n$$
An orthogonal bases for all polynomials of degree less than or equal to $n$ can be computed using Gram-schmidt orthogonalization process. First we start with the following standard basis vectors in $W$
$$ \{ 1, x, \ldots, x^n \}$$The Gram-Schmidt process can be used to make these vectors orthogonal. The resulting polynomials on $[-1,1]$ are called Legendre polynomials. The first six Legendre polynomial basis are:
$$1$$$$x$$$$x^2 -\frac{1}{3}$$$$x^3 - \frac{3}{5}x$$$$x^4 - \frac{6}{7}x^2 + \frac{3}{35}$$$$x^5 - \frac{10}{9}x^3 + \frac{5}{12}x$$✅QUESTION:</font> What is the least-squares linear approximations of $f(x) = e^x$ over the interval $[-1, 1]$. In other words, what is the projection of $f$ onto $W$, where $W$ is a first order polynomal with basis vectors $\{1, x\} (i.e. n=1)$. (Hint: You can give the answer in integrals without computing the integrals. Note the Legendre polynomials are not normalized.)
Put your answer to the above question here.
Here is a plot of the equation $f(x) = e^x$:
%matplotlib inline
import matplotlib.pylab as plt
import numpy as np
#px = np.linspace(-1,1,100)
#py = np.exp(px)
#plt.plot(px,py, color='red');
import sympy as sym
from sympy.plotting import plot
x = sym.symbols('x')
f = sym.exp(x)
plot(f,(x,-1,1))
<sympy.plotting.plot.Plot at 0x7f91d6251940>
We can use sympy
to compute the integral. The following code compute the definite integral of
$$\int_{-1}^1 e^x dx.$$
In fact, sympy
can also compute the indefinite integral by removing the interval.
sym.init_printing()
x = sym.symbols('x')
sym.integrate('exp(x)',(x, -1, 1))
#sym.integrate('exp(x)',(x))
Use sympy
to compute the first order polynomial that approximates the function $e^x$.
The following calculates the above approximation written in sympy
:
g_0 = sym.integrate('exp(x)*1',(x, -1, 1))/sym.integrate('1*1',(x,-1,1))*1
g_1 = g_0 + sym.integrate('exp(x)*x',(x,-1,1))/sym.integrate('x*x',(x,-1,1))*x
g_1
Plot the original function $f(x)=e^x$ and its approximation.
p2 = plot(f, g_1,(x,-1,1))
#For fun, I turned this into a function:
x = sym.symbols('x')
def lsf_poly(f, gb = [1, x], a =-1, b=1):
proj = 0
for g in gb:
# print(sym.integrate(g*f,(x,a,b)))
proj = proj + sym.integrate(g*f,(x,a,b))/sym.integrate(g*g,(x,a,b))*g
return proj
lsf_poly(sym.exp(x))
✅**QUESTION:** What would a second order approximation look like for this function? How about a fifth order approximation?
Put your answer to the above question here
#####Start your code here #####
x = sym.symbols('x')
g_2 =
g_2
#####End of your code here#####
File "<ipython-input-1-fc21e28bfb70>", line 3 g_2 = ^ SyntaxError: invalid syntax
p2 = plot(f, g_2,(x,-1,1))
--------------------------------------------------------------------------- NameError Traceback (most recent call last) <ipython-input-1-20e1ce19dce4> in <module> ----> 1 p2 = plot(f, g_2,(x,-1,1)) NameError: name 'g_2' is not defined
If you attend class in-person then have one of the instructors check your notebook and sign you out before leaving class. If you are attending remote, turn in your assignment using D2L.
Written by Dr. Dirk Colbry, Michigan State University
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.