Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Project: aprox
Views: 32
var('t') f(t)=t uu=plot(f(t),(t,-1/10,11/10),color='red') h0(t)=sin(t*pi) h1(t)=sin(2*t*pi) h2(t)=sin(4*t*pi) h3(t)=sin(6*t*pi) #proyección 2*<f,sin(x)>*sin(x)+2*<f,sin(2x)>*sin(2x)... k0=integral(f(t)*h0(t),t,0,1) k1=integral(f(t)*h1(t),t,0,1) k2=integral(f(t)*h2(t),t,0,1) k3=integral(f(t)*h3(t),t,0,1) nor1=integral(h1(t)^2,t,0,1) leito0(t)=k0*h0(t)/nor1 leito1(t)=k1*h1(t)/nor1 leito2(t)=k1*h1(t)/nor1+k2*h2(t)/nor1 leito3(t)=k1*h1(t)/nor1+k2*h2(t)/nor1+k3*h3(t)/nor1 leito4(t)=leito0(t)+k1*h1(t)/nor1+k2*h2(t)/nor1+k3*h3(t)/nor1 uz=plot(leito0(t),(t,0,1),color='yellow') uw=plot(leito4(t),(t,0,1),color='green') pepe=uu+uw+uz pepe.show()
t
var('t') h1(t)=2*t;h2(t)=2-2*t f=piecewise([[(0,1/2),h1(t)],[(1/2,1),h2(t)]]) f.integral(definite=True) plot(f(t),t,0,1)
t 1/2
q(t)=f(t)*sin(t) plot(q(t),(t,0,2*pi))
verbose 0 (3748: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 168 points. verbose 0 (3748: plot.py, generate_plot_points) Last error message: 'point 6.25224298758 is not in the domain'
var('t') f(t)=t uu=plot(f(t),(t,-1/10,11/10),color='red') h0(t)=sin(t*pi) h1(t)=sin(2*t*pi) h2(t)=sin(4*t*pi) h25(t)=sin(5*t*pi) h3(t)=sin(6*t*pi) #proyección 2*<f,sin(x)>*sin(x)+2*<f,sin(2x)>*sin(2x)... k0=integral(f(t)*h0(t),t,0,1) k1=integral(f(t)*h1(t),t,0,1) k2=integral(f(t)*h2(t),t,0,1) k25=integral(f(t)*h25(t),t,0,1) k3=integral(f(t)*h3(t),t,0,1) nor1=integral(h1(t)^2,t,0,1) leito0(t)=k0*h0(t)/nor1 leito1(t)=k1*h1(t)/nor1 leito2(t)=k1*h1(t)/nor1+k2*h2(t)/nor1 leito3(t)=k1*h1(t)/nor1+k2*h2(t)/nor1+k3*h3(t)/nor1 leito4(t)=leito0(t)+k1*h1(t)/nor1+k2*h2(t)/nor1+k3*h3(t)/nor1 leito5(t)=leito0(t)+k1*h1(t)/nor1+k2*h2(t)/nor1+k25*h25(t)/nor1+k3*h3(t)/nor1 uz=plot(leito0(t),(t,0,1),color='yellow') uw=plot(leito4(t),(t,0,1),color='green') ut=plot(leito5(t),(t,0,1),color='purple') pepe=uu+uw+uz+ut pepe.show()
t
t=var('t') h1(t)=2*t;h2(t)=2-2*t f=piecewise([[(0,1/2),h1(t)],[(1/2,1),h2(t)]]) #f.integral(definite=True) uta=plot(f(t),(t,0,1)) w1(t)=sin(t*pi) #nos vamos a aproximar con funciones senos w2(t)=sin(2*t*pi) w3(t)=sin(3*t*pi) w4(t)=sin(4*t*pi) k1=integral(w1(t)*h1(t),t,0,1/2)+integral(w1(t)*h2(t),t,1/2,1) k2=integral(w2(t)*h1(t),t,0,1/2)+integral(w2(t)*h2(t),t,1/2,1) k3=integral(w3(t)*h1(t),t,0,1/2)+integral(w3(t)*h2(t),t,1/2,1) k4=integral(w4(t)*h1(t),t,0,1/2)+integral(w4(t)*h2(t),t,1/2,1) print k1,k2,k3,k4 nor=integral((w1(t))^2,t,0,1) theta1(t)=k1/nor*w1(t) theta2(t)=k1/nor*w1(t)+k2/nor*w2(t) theta3(t)=k1/nor*w1(t)+k2/nor*w2(t)+k3/nor*w3(t) theta4(t)=k1/nor*w1(t)+k2/nor*w2(t)+k3/nor*w3(t)+k4/nor*w4(t) uta1=plot(theta1(t),(t,0,1),color='yellow') uta2=plot(theta2(t),(t,0,1),color='green') uta3=plot(theta3(t),(t,0,1),color='purple') uta4=plot(theta4(t),(t,0,1),color='red') mett=uta+uta1+uta4 mett.show()
4/pi^2 0 -4/9/pi^2 0