Docsity

Métodos numéricos para integrales y derivadas: Romberg y diferencias (adelante y atrás), Ejercicios de Matemáticas

Vista previa parcial del texto

¡Descarga Métodos numéricos para integrales y derivadas: Romberg y diferencias (adelante y atrás) y más Ejercicios en PDF de Matemáticas solo en Docsity!

Unidad 3

Jean Fran Jaimes Alvarado, Yhorly Morales Alvarado, Roberto Rodriguez Soto

Mayo 2021

1 °problema:Realizar un diagrama de flujo , simulación y código en matlab que calcule una integral por el método de Romberg.

INICIO

a.b,n,funci

J<n-

J=J+

h=h/

S=

P=1:M

R(J+1,1)=(0,5)R(J,1)+hs

M=2:M

M=

h=b-a J= R=zeros(n,n) R(1,1)=f(feval(funci,a)+feval(f,b))/

x=a+h(2p-1) f3=feval(funci,x)

s=s+f

2 °Problema: Realizar un diagrama de flujo , simulación y código en matlab que calcule una integral doble por el método de Simpson-

Inicio f,a,b,c,d,n h=b-a/n k=d-c/n w=0^ s= H=0 P= W=0 T= R=0 Z= X=0 Y= g=2:2:n- i=c+gk m=2:2:n- u=(k/3)2(h/3)2f(o,i)^ o=a+mh w=w+u g=2:2:n- i=c+gk j=1:2:n- t=(k/3)2(h/3)4(f(l,i))^ l=a+jh Y=Y+t e=1:2:n- f=c+ek m=2:2:n- q=(k/3)4(h/3)2f(o,f)^ o=a+mh s=s+q e=1:2:n- f=c+ek j=1:2:n- p=(k/3)4(h/3)4f(l,f)^ l=a+jh Z=Z+p C=1:2:n- r=(k/3)4(h/3)(f(a,S)+f(b,S))^ S=c+Ck T=T+r U=2:2:n- v=(k/3)2(h/3)(f(a,V)+f(b,V))^ V=c+Uk W=W+v A=1:2:n- E=(k/3)(h/3)4f(B,c)^ B=a+Ah H=H+E C=2:2:n- F=(k/3)(h/3)2(f(D,c))^ D=a+Ch X=X+F I=1:2:n- M=(k/3)(h/3)4f(J,d)^ J=a+Ih P=P+M K=2:2:n- N=(k/3)(h/3)2f(L,d)^ L=a+Kh R=R+N G=(k/3)(h/3)((f(a,c)+f(b,c)) O=(k/3)(h/3)(f(a,d)+f(b,d)) Q=s+w+H+P+O+G+W+T+Z+R+X+Y Q Final

61 end 62 for C =2:2: n - 63 D = a + C * h ; 64 F =( k /3) *( h /3) 2( funci2 (D , c ) ) ; 65 X = X + F ; 66 end 67 O =( k /3) *( h /3) *(( funci2 (a , d ) ) +( funci2 (b , d ) ) ) ; 68 for I =1:2: n - 69 J = a + I * h ; 70 M =( k /3) *( h /3) 4( funci2 (J , d ) ) ; 71 P = P + M ; 72 end 73 for K =2:2: n - 74 L = a + K * h ; 75 N =( k /3) *( h /3) 2( funci2 (L , d ) ) ; 76 R = R + N ; 77 end 78 Q = s + w + H + P + O + G + W + T + Z + R + X + Y 79 end

3 ° Problema: Calcular la primera, segunda y tercera derivada de la función f (x) utilizando la diferencia hacia atras. Según la expresión de la serie de Taylor hacia atras:

f (x − h) = f (x) − hf ′(x) + h^2 2! f ′′(x) − h^3 3! f ′′′(x) + h^4 4! f ′′′′(x)

1. Pimera derivada

hf ′(x) = (f (x) + h

2 2! f ′′(x) − h

3 3! f ′′′(x) + h

4 4! f ′′′′(x) − ...) − f (x − h)

f ′(x) = ( f (x) h

h 2! f ′′(x) − h^2 3! f ′′′(x) + h^3 4! f ′′′′(x) − ...) − f (x − h) h

2. Segunda derivada

f (x − h) = f (x) − hf ′(x) + h^2 2! f^

′′(x) − h 3 3! f^

′′′(x) + ... (2)

f (x − 2 h) = f (x) − 2 hf ′(x) + (2h)

2 2 f ′′(x) − (2h)

3 3!

Operar 2(2) − (3)

f (x − 2 h) − 2 f (x − h) = −f (x) + h^2 f ′′(x) − h^3 f ′′′(x) + ...

f ′′(x) = f (x − 2 h) − 2 f (x + h) + f (x) h^2

  • 0(h)

f ′′(x) = f (x − 2 h) − 2 f (x − h) + f (x) h^2

Operando (4) en (1)

f ′(x) = ( f (x) h

h 2!

f (x − 2 h) − 2 f (x + h) + f (x) h^2

h^2 3! f ′′′(x) + ...) − f (x − h) h

f ′(x) = f (x) h

f (x − h) h

h 2!

f (x − 2 h) − 2 f (x − h) + f (x) h^2 − (0)h)

f ′(x) = 2 f (x) 2 h

2 f (x − h) 2 h

f (x − 2 h) 2 h

2 f (x − h) 2 h

f (x) 2 h f ′(x) = 2 f (x) − 2 f (x − h) + f (x − 2 h) − 2 f (x − h) + f (x) 2 h La primera derivada hacia atras será:

f ′(x) = 3 f (x) − 4 f (x − h) + f (x − 2 h) 2 h

4 ° Problema: Calcular la primera, segunda y tercera derivada de la función f (x) utilizando la diferencia hacia adelante Segun la expasión serie de Taylor hacia adelante:

f (x + h) = f (x) + hf ′(x) + h

2 2 f ′′(x) + h

3 3! f ′′′(x) + h

4 4! f ′′′′(x)

1. Pimera derivada

f (x + h) = f (x) + hf ′(x) + h

2 2 f ′′(x) + h

3 3! f ′′′(x) + ...

f ′(x) = f (x + h) − f (x) h −^

h 2 f^

′′(x)

f ′(x) = f (x + h) − f (x) h − Oh....(α)

2. Segunda derivada

f (x + h) = f (x) + hf ′(x) + h

2 2 f ′′(x) + h

3 3!

f (x + 2h) = f (x) + 2hf ′(x) + (2h)^2 2 f ′′(x) + (2h)^3 3!

Operar 2(1) − (2)

f (x + 2h) − 2 f (x + h) = −f (x) + h^2 f ′′(x) + h^3 f ′′′(x) + ...

f ′′(x) = f (x + 2h) − 2 f (x + h) + f (x) h^2 ....(β)

3. Tercera derivada

f (x + h) = f (x) + hf ′(x) + h

2 2 f ′′(x) + h

3 3!

f (x + 2h) = f (x) + 2hf ′(x) + (2h)

2 2 f ′′(x) + (2h)

3 3!

f (x + 3h) = f (x) + 3hf ′(x) + (3h)^2 2 f ′′(x) + (3h)^3 3!

Operar 2(1) − (2)

2 f (x + h) − f (x + 2h) = f (x) − h^2 f ′′(x) − h^3 f ′′′(x) (4)

Operar 3(1) − (3)

3 f (x + h) − f (x + 3h) = 2(x) − 3 h^2 f ′′(x) − 4 h^3 f ′′′(x) (5)

Operar 3(4) − (5)

6 f (x + h) − 3 f (x + 2h) − 3 f (x + h) + f (x + h) = f (x) + h^3 f ′′′(x)

f ′′′(x) = 3 f (x + h) − 3 f (x + 2h) + f (x + 3h) − f (x) h^3 ....(γ)

Reemplazando el error, (β) − (α)

f ′(x) = f (x + h) − f (x) h −^ Oh

f ′(x) = f (x + h) − f (x) h −^

h 2 (^

f (x + 2h) − 2 f (x + h) + f (x) h^2 )

f ′(x) = −f (x + 2h) + 4f (x + h) − 3 f (x) 2 h ....(δ) Las derivadas son:

f ′(x) = −f (x + 2h) + 4f (x + h) − 3 f (x) 2 h ....(δ)

f ′′(x) = f (x + 2h) − 2 f (x + h) + f (x) h^2 ....(β)

f ′′′(x) = 3 f (x + h) − 3 f (x + 2h) + f (x + 3h) − f (x) h^3 ....(γ)