04.07.2017 Views

Análisis numérico, Timothy Sauer

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

7.2 Métodos de diferencias finitas | 363<br />

R jacobiano DF(w) de Fes<br />

—2 -f-A2senu>| l — h/2 0 ••• 0<br />

1 + h/2 -2 -\-h 2senu>2 **• **• i<br />

0 1 + h/2 \ — hf2 0<br />

: - 2 + h2scnw„-i 1 - h/2<br />

0 ••• 0 I + h/2 - 2 + /»2senu)„ _<br />

R siguiente código puede insertarse en el programa 7.1, junto oon los cambios apropiados en<br />

la información de las condiciones de frontera, para manejar el problema de valor de frontera no<br />

lineal:<br />

fu n ction y = f(w ,in te r,b v ,n )<br />

y = z e r o s ( n ,l ) ; h s ( i n t e r ( 2 ) - i n t e r ( l ) ) / ( n + l ) ;<br />

y ( l ) - - 2 * w ( l ) ♦ (l+h/2)*bv( 1 )+ (l-h /2)*w ( 2 ) -h*h *coo(w (l));<br />

y ( n ) = (l+h/2)*w(n- 1 ) -2*w (n)-h*h*coa(w( n ) ) + ( l- h /2 ) * b v (2);<br />

for j =2:n-l<br />

y ( j ) —2*w(j) + (l+h/2)*w(j-l) + (i-h/2)*w(j+i)-h*h*coa(w(j));<br />

end<br />

fu n ction a = ja c(w ,in ter,b v ,n )<br />

a = z e r o a ( n ,n ) ; h = ( in t e r ( 2 ) - in t e r ( l) ) /( n + l) ;<br />

for j« l:n<br />

a (j , j)= -2 + h * h * a in (w (j));<br />

end<br />

for j =1 :n- 1<br />

a (j , j + l ) = l - h /2 ;<br />

a ( j + l ,j ) - l + h / 2 ;<br />

end<br />

En la figura 7.8i0) = 0<br />

(b)<br />

/ = (2 + 4i2)y<br />

y( 0) = 1<br />

y{\) = e<br />

Grafique las soluciones aproximadasjunto con las soluciones exactas (a)> y (b) y(f) = é ‘\<br />

además, muestre los errores oomo una función de i en una gráfica semilogarítmica por separado.<br />

2. Utilice diferencias finitas para aproximar las soluciones a los PVF lineales con n = 9. 19 y 39.<br />

(a)<br />

9 y ” + 7 0 - = O<br />

v(0) = -1<br />

yi¡) = 3<br />

(b)<br />

/ = 3 > > - 2 y<br />

y{0) = e3<br />

v

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!