Está en la página 1de 8

UNIVERSIDAD NACIONAL DEL CENTRO DEL PERU

FACULTAD INGENIERIA QUIMICA


CATEDRA: METODOS NUMERICOS
PRESENTADO POR: TORRES RIVERA LESLIE

ECUACIONES DIFERENCIALES
ORDINARIAS
Resolver la siguiente ecuación diferencial:

dy
=x∗cos ⁡( y )2
dx
Si:

Y(0)=3

Y(3)=?

METODO DE TAYLOR
h=(3-0)/10;
x0=0;y0=3;
x1=x0+1*h;
x2=x0+2*h;
x3=x0+3*h;
x4=x0+4*h;
x5=x0+5*h;
x6=x0+6*h;
x7=x0+7*h;
x8=x0+8*h;
x9=x0+9*h;
x10=x0+10*h;
f0=x0*cos(y0)*cos(y0);
df0=cos(y0)*cos(y0)-2*x0*x0*cos(y0)*cos(y0)*sin(y0);
y1=y0+h*f0+(h*h)/2*df0;
f1=x1*cos(y1)*cos(y1);
df1=cos(y1)*cos(y1)+2*x1*x1*cos(y1)*cos(y1)*sin(y1);
y2=y1+h*f1+(h*h)/2*df1;
f2=x2*cos(y2)*cos(y2);
df2=cos(y2)*cos(y2)+2*x2*x2*cos(y2)*cos(y2)*sin(y2);
y3=y2+h*f2+(h*h)/2*df2;
f3=x3*cos(y3)*cos(y3);
df3=cos(y3)*cos(y3)+2*x3*x3*cos(y3)*cos(y3)*sin(y3);
y4=y3+h*f3+(h*h)/2*df3;
f4=x4*cos(y4)*cos(y4);
df4=cos(y4)*cos(y4)+2*x4*x4*cos(y4)*cos(y4)*sin(y4);
y5=y4+h*f4+(h*h)/2*df4;
f5=x5*cos(y5)*cos(y5);
df5=cos(y5)*cos(y5)+2*x5*x5*cos(y5)*cos(y5)*sin(y5);
y6=y5+h*f5+(h*h)/2*df5;
f6=x6*cos(y6)*cos(y6);
df6=cos(y6)*cos(y6)+2*x6*x6*cos(y6)*cos(y6)*sin(y6);
y7=y6+h*f6+(h*h)/2*df6;
f7=x7*cos(y7)*cos(y7);
df7=cos(y7)*cos(y7)+2*x7*x7*cos(y7)*cos(y7)*sin(y7);
y8=y7+h*f7+(h*h)/2*df7;
f8=x8*cos(y8)*cos(y8);
df8=cos(y8)*cos(y8)+2*x8*x8*cos(y8)*cos(y8)*sin(y8);
y9=y8+h*f8+(h*h)/2*df8;
f9=x9*cos(y9)*cos(y9);
df9=cos(y9)*cos(y9)+2*x9*x9*cos(y9)*cos(y9)*sin(y9);
y10=y9+h*f9+(h*h)/2*df9

>> Untitled21

y10 =

4.3719

MÉTODO DE EULER
%metodo de euler
clc
t0=0;
tf=30;
n=10;
h=(tf-t0)/n;
t1=t0+h;
t2=t1+h;
t3=t2+h;
t4=t3+h;
t5=t4+h;
t6=t5+h;
t7=t6+h;
t8=t7+h;
t9=t8+h;
t10=t9+h;
x0=0;
x1=x0+h*(1.44*10^-2*(0.59-x0)*(0.875-x0));
x2=x1+h*(1.44*10^-2*(0.59-x1)*(0.875-x1));
x3=x2+h*(1.44*10^-2*(0.59-x2)*(0.875-x2));
x4=x3+h*(1.44*10^-2*(0.59-x3)*(0.875-x3));
x5=x4+h*(1.44*10^-2*(0.59-x4)*(0.875-x4));
x6=x5+h*(1.44*10^-2*(0.59-x5)*(0.875-x5));
x7=x6+h*(1.44*10^-2*(0.59-x6)*(0.875-x6));
x8=x7+h*(1.44*10^-2*(0.59-x7)*(0.875-x7));
x9=x8+h*(1.44*10^-2*(0.59-x8)*(0.875-x8));
x10=x9+h*(1.44*10^-2*(0.59-x9)*(0.875-x9));
disp(' i ti xi ')
fprintf('%9.0f %12.5f %12.5f \n' ,0,t0,x0)
fprintf('%9.0f %12.5f %12.5f \n' ,1,t1,x1)
fprintf('%9.0f %12.5f %12.5f \n' ,2,t2,x2)
fprintf('%9.0f %12.5f %12.5f \n' ,3,t3,x3)
fprintf('%9.0f %12.5f %12.5f \n' ,4,t4,x4)
fprintf('%9.0f %12.5f %12.5f \n' ,5,t5,x5)
fprintf('%9.0f %12.5f %12.5f \n' ,6,t6,x6)
fprintf('%9.0f %12.5f %12.5f \n' ,7,t7,x7)
fprintf('%9.0f %12.5f %12.5f \n' ,8,t8,x8)
fprintf('%9.0f %12.5f %12.5f \n' ,9,t9,x9)
fprintf('%9.0f %12.5f %12.5f \n' ,10,t10,x10)

SALIDA:

>> i ti xi
0 0.00000 0.00000
1 3.00000 0.02230
2 6.00000 0.04321
3 9.00000 0.06286
4 12.00000 0.08136
5 15.00000 0.09880
6 18.00000 0.11527
7 21.00000 0.13085
8 24.00000 0.14561
9 27.00000 0.15961
10 30.00000 0.17291
>>

METODO DE EULER MODIFICADO


h=(3-0)/10;
x0=0;y0=3;
x1=x0+1*h;
x2=x0+2*h;
x3=x0+3*h;
x4=x0+4*h;
x5=x0+5*h;
x6=x0+6*h;
x7=x0+7*h;
x8=x0+8*h;
x9=x0+9*h;
x10=x0+10*h;
f0=x0*cos(y0)*cos(y0);
a1=y0+h*f0;
y1=y0+h/2*(f0+x1*cos(a1)*cos(a1));
f1=x1*cos(y1)*cos(y1);
a2=y1+h*f1;
y2=y1+h/2*(f1+x2*cos(a2)*cos(a2));
f2=x2*cos(y2)*cos(y2);
a3=y2+h*f2;
y3=y2+h/2*(f2+x3*cos(a3)*cos(a3));
f3=x3*cos(a3)*cos(a3);
a4=y3+h*f3;
y4=y3+h/2*(f3+x4*cos(a4)*cos(a4));
f4=x4*cos(y4)*cos(y4);
a5=y4+h*f4;
y5=y4+h/2*(f4+x5*cos(a5)*cos(a5));
f5=x5*cos(y5)*cos(y5);
a6=y5+h*f5;
y6=y5+h/2*(f5+x6*cos(a6)*cos(a6));
f6=x6*cos(y6)*cos(y6);
a7=y6+h*f6;
y7=y6+h/2*(f6+x7*cos(a7)*cos(a7));
f7=x7*cos(y7)*cos(y7);
a8=y7+h*f7;
y8=y7+h/2*(f7+x8*cos(a8)*cos(a8));
f8=x8*cos(y8)*cos(y8);
a9=y8+h*f8;
y9=y8+h/2*(f8+x9*cos(a9)*cos(a9));
f9=x9*cos(y9)*cos(y9);
a10=y9+h*f9;
y10=y9+h/2*(f9+x10*cos(a10)*cos(a10))

y10 =

4.4793

METODO DE RUNGE-KUTTA
i x y k1 k2 k3 k4
0 0 3 0 0,14701277 0,14786669 0,29717267 0,02956439
1 0,3 3,02956439 0,29625062 0,4479473 0,44909598 0,59969086 0,0896676
2 0,6 3,11923199 0,59970005 0,74657847 0,74399149 0,8641836 0,14816745
3 0,9 3,26739944 0,88583038 0,98129146 0,97366916 1,00234395 0,19326985
4 1,2 3,46066929 1,08191835 1,06061566 1,06414832 0,96744776 0,20996314
5 1,5 3,67063243 1,11790987 0,97054293 1,00629029 0,81816155 0,1963246
6 1,8 3,86695702 1,00780138 0,79826642 0,85884947 0,64571679 0,16559166
7 2,1 4,03254869 0,82997145 0,62545034 0,68819907 0,49882251 0,13186976
8 2,4 4,16441845 0,65134833 0,4829833 0,53443936 0,38579373 0,10239958
9 2,7 4,26681803 0,50149223 0,37334962 0,41108373 0,30089209 0,0790417
10 3 4,34585973 0,38530306 0,29082806 0,31718534 0,23711662 0,06128155

ECUACIONES DIFERENCIALES ORDINARIAS


DE ORDEN SUPERIOR
y ' =z

z ' =x 2+ sen ( y )∗z


Y(1)=1
Z(1)=2
Y(3)=?

RESOLVIENDO EN EXCEL PARA n=20


h 0,1

i x yi zi k1 k2 k3 k4 sum c1 c2 c3 c4 sum
i a1 a2
0 1 1 2 2 2,13 2,15 2,30 0,21 2,68 3,00 3,02 3,36 0,30
414 022 252 452 294 446 529 833 184
71 338 937 117 197 76 365 848 672
1 1 1,21 2,30 2,30 2,47 2,48 2,67 0,24 3,36 3,72 3,74 4,10 0,37
, 452 184 184 021 790 617 823 729 121 331 073 328
1 117 672 671 154 742 817 771 649 407 456 424 48
6
2 1 1,46 2,67 2,67 2,88 2,89 3,12 0,28 4,09 4,44 4,45 4,75 0,44
, 275 513 513 010 721 091 917 953 165 784 954 430
2 889 152 151 824 43 556 82 451 574 045 783 125
6
3 1 1,75 3,11 3,11 3,35 3,36 3,61 0,33 4,75 4,99 4,98 5,10 0,49
, 193 943 943 735 897 826 650 839 087 836 352 700
3 709 276 276 252 674 964 602 517 961 879 434 694
1
4 1 2,08 3,61 3,61 3,87 3,86 4,11 0,38 5,10 5,06 5,03 4,79 0,50
, 844 643 643 157 981 985 698 263 745 412 597 169
4 31 97 969 148 254 222 433 563 684 518 829 63
9
5 1 2,47 4,11 4,11 4,35 4,33 4,54 0,43 4,79 4,33 4,28 3,60 0,42
, 542 813 813 788 504 627 417 490 818 134 822 736
5 744 6 599 139 511 038 099 774 222 386 153 969
9
6 1 2,90 4,54 4,54 4,72 4,68 4,81 0,46 3,60 2,74 2,70 1,76 0,27
, 959 550 550 576 274 574 963 509 480 239 269 103
6 843 569 568 055 571 502 772 713 051 329 214 628
9
7 1 3,37 4,81 4,81 4,90 4,85 4,89 0,48 1,75 0,80 0,80 - 0,08
, 923 654 654 434 676 728 726 612 442 743 0,00 297
7 615 197 197 814 347 521 751 339 994 243 139 414
999
8 1 3,86 4,89 4,89 4,89 4,86 4,84 0,48 - - - - -
, 650 951 951 908 859 019 791 0,00 0,61 0,59 0,92 0,05
8 365 611 610 029 771 959 786 871 836 316 158 588
6 638 782 515 677 948
9 1 4,35 4,84 4,84 4,79 4,79 4,74 0,47 - - - - -
, 442 362 362 729 549 766 961 0,92 0,96 0,95 0,71 0,09
9 151 662 662 695 284 788 457 659 267 958 262 139
1 349 555 738 074 567
1 2 4,83 4,75 4,75 4,71 4,74 4,72 0,47 - - - 0,49 -
0 403 223 223 637 159 829 327 0,71 0,21 0,23 640 0,01
608 095 095 533 239 497 436 711 277 935 79 874
3 249 12 987 945
1 2 5,30 4,73 4,73 4,75 4,80 4,87 0,47 0,48 1,41 1,39 2,52 0,14
1 , 731 348 348 796 433 249 884 976 706 018 351 379
1 044 151 150 981 489 963 318 602 76 12 62 633
7
1 2 5,78 4,87 4,87 5,00 5,06 5,25 0,50 2,51 3,80 3,82 5,34 0,38
2 , 615 727 727 299 774 968 464 442 938 403 124 537
2 361 784 783 902 727 15 087 372 865 661 444 531
7
1 2 6,29 5,26 5,26 5,52 5,61 5,97 0,55 5,33 7,00 7,09 8,97 0,70
3 , 079 265 265 915 271 220 864 004 125 553 716 834
3 448 315 314 535 576 619 336 405 224 042 424 623
9
1 2 6,84 5,97 5,97 6,41 6,51 7,07 0,64 8,96 10,8 11,0 12,8 1,09
4 , 943 099 099 916 536 639 860 328 872 539 900 559
4 784 938 937 345 3 401 744 156 725 464 438 605
6
1 2 7,49 7,06 7,06 7,71 7,77 8,49 0,77 12,8 14,2 14,2 14,5 1,40
5 , 804 659 659 027 723 422 559 736 127 763 097 602
5 528 543 542 87 305 857 746 655 525 314 845 696
5
1 2 8,27 8,47 8,47 9,19 9,12 9,75 0,91 14,4 13,1 12,8 9,59 1,26
6 , 364 262 262 749 956 689 472 974 389 426 197 754
6 274 239 239 38 759 041 726 282 04 802 153 28
1 2 9,18 9,74 9,74 10,2 9,99 10,2 1,00 9,57 5,02 4,85 0,77 0,50
7 , 837 016 016 187 158 255 643 126 840 385 503 184
7 519 519 284 535 502 905 378 305 037 904 683
4
1 2 10,1 10,2 10,2 10,2 10,1 10,0 1,01 0,70 - - - -
8 , 948 420 420 775 555 802 980 994 1,72 1,61 1,43 0,12
8 09 12 120 093 232 167 49 598 977 795 859 373
2 603 291 148 506
1 2 11,2 10,1 10,1 10,0 10,1 10,2 1,01 - 1,18 1,05 5,64 0,14
9 , 146 182 182 449 774 242 312 1,46 355 967 813 446
9 139 77 769 511 545 446 221 651 016 603 272 781
6 668
2 3 12,2 10,2 10,2 10,5 10,8 11,3 1,07 5,59 11,1 11,3 17,3 1,13
0 277 627 627 422 193 957 302 072 328 296 217 062
362 448 447 809 865 129 987 22 349 811 554 516
7

RESOLVIENDO EN MATLAB n=20


h=(3-1)/20;
x0=1;y0=1;z0=2;
for i=1:20;
x1=1+i*h;
k1=z0;
c1=x0*x0+sin(y0)*z0;
k2=z0+h/2*c1;
c2=(x0+h/2)*(x0+h/2)+sin(y0+h/2*k1)*(z0+h/2*c1);
k3=z0+h/2*c2;
c3=(x0+h/2)*(x0+h/2)+sin(y0+h/2*k2)*(z0+h/2*c2);
k4=z0+h*c3;
c4=(x0+h)*(x0+h)+sin(y0+h*k3)*(z0+h*c3);
y1=y0+h/6*(k1+2*k2+2*k3+k4);
z1=z0+h/6*(c1+2*c2+2*c3+c4);
disp([x1;y1;z1]);
x0=x1;y0=y1;z0=z1;
end

>> Untitled21
1.1000
1.2145
2.3018

1.2000
1.4628
2.6751

1.3000
1.7519
3.1194

1.4000
2.0884
3.6164

1.5000
2.4754
4.1181

1.6000
2.9096
4.5455

1.7000
3.3792
4.8165

1.8000
3.8665
4.8995

1.9000
4.3544
4.8436

2.0000
4.8340
4.7522

2.1000
5.3073
4.7335
2.2000
5.7862
4.8773

2.3000
6.2908
5.2627

2.4000
6.8494
5.9710

2.5000
7.4980
7.0666

2.6000
8.2736
8.4726

2.7000
9.1884
9.7402

2.8000
10.1948
10.2420

2.9000
11.2146
10.1183

3.0000
12.2277
10.2627

También podría gustarte