| Hosted by CoCalc | Download
typeset_mode(True)

Question 2

A =matrix(QQ,[[2,1,-2,-1],[4,4,-3,1],[2,7,1,8]]) A.echelonize() A
(1054540112320000)\displaystyle \left(\begin{array}{rrrr} 1 & 0 & -\frac{5}{4} & -\frac{5}{4} \\ 0 & 1 & \frac{1}{2} & \frac{3}{2} \\ 0 & 0 & 0 & 0 \end{array}\right)
B=matrix(QQ,[[5/4,5/4,-5],[-1/2,-3/2,10],[1,0,4],[0,1,-8]]) B.echelonize() B
(104018000000)\displaystyle \left(\begin{array}{rrr} 1 & 0 & 4 \\ 0 & 1 & -8 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{array}\right)

Question 4

u1=vector([3,0,4]) u2=vector([-1,0,7]) u3=vector([2,9,11])
def proj(p,q):#la projection de p sur q return p.dot_product(q)/q.dot_product(q) * q
v1=u1 v2 = u2-proj(u2,v1) v2
(4,0,3)\displaystyle \left(-4,\,0,\,3\right)
v3 = u3-proj(u3,v1)-proj(u3,v2) v3
(0,9,0)\displaystyle \left(0,\,9,\,0\right)
v2.dot_product(v3)
0\displaystyle 0

Question 5

f1(x) = 1 f2(x)=cos(x) f3(x)=sin(x) h(x)=x^2
g1(x) = f1(x)/sqrt(integral(f1(x)*f1(x),x,-pi,pi)) g1(x)
22π\displaystyle \frac{\sqrt{2}}{2 \, \sqrt{\pi}}
g2(x) = f2(x)/sqrt(integral(f2(x)*f2(x),x,-pi,pi)) g2(x)
cos(x)π\displaystyle \frac{\cos\left(x\right)}{\sqrt{\pi}}
g3(x) = f3(x)/sqrt(integral(f3(x)*f3(x),x,-pi,pi)) g3(x)
sin(x)π\displaystyle \frac{\sin\left(x\right)}{\sqrt{\pi}}
c1 = integral(g1(x)*h(x),x,-pi,pi) c1 c2 = integral(g2(x)*h(x),x,-pi,pi) c2 c3 = integral(g3(x)*h(x),x,-pi,pi) c3
132π52\displaystyle \frac{1}{3} \, \sqrt{2} \pi^{\frac{5}{2}}
4π\displaystyle -4 \, \sqrt{\pi}
0\displaystyle 0
H(x) = c1 * g1(x) + c2*g2(x) CourbeH = plot(H(x),x,-pi,pi) Courbeh = plot(h(x),x,-pi,pi, color="red") C1 = plot(f1(x),x,-pi,pi, color="darkgreen", linestyle="dotted") C2 = plot(f2(x),x,-pi,pi, color="darkgreen", linestyle="dotted") C3 = plot(f3(x),x,-pi,pi, color="darkgreen", linestyle="dotted") show(CourbeH + Courbeh + C1+C2+C3, figsize = 4)

La courbe bleue représente la projection de h(x)h(x) sur l'espace engendré par les trois fonctions données dans l'énoncé. Il s'agit de la courbe qui peut approcher le mieux la parabole rouge, parmi toutes les courbes que l'on peut construire en faisant des combinaisons linéaires des trois fonctions données (en pointillés verts)

Question 6

def ps(p,q): return integrate(exp(-x^2)* p(x)*q(x),x,-infinity,infinity) def pproj(p,q): return ps(p,q)/ps(q,q)*q
u0(x) = 1 u1(x) = x u2(x) = x^2
f0(x) = u0(x) f0(x)
1\displaystyle 1
ps(f0,f0)
π\displaystyle \sqrt{\pi}
f1(x) = u1- pproj(u1,f0) f1(x)
x\displaystyle x
ps(f1,f1)
12π\displaystyle \frac{1}{2} \, \sqrt{\pi}
f2(x) = u2 - pproj(u2,f0) - pproj(u2,f1) f2(x)
x212\displaystyle x^{2} - \frac{1}{2}
ps(f2,f2)
12π\displaystyle \frac{1}{2} \, \sqrt{\pi}
︠cd9f0bef-cbb3-4a5e-b61e-12b4ef292ac6︠