Documentos de Académico
Documentos de Profesional
Documentos de Cultura
1. Resolver cada ejercicio haciendo uso de: método de trapecio compuesto usando
n=100, Simpson 3/8 compuesto usando n=900 y cuadratura de gauss legendre
usando n=5.
a)
t. compuesto
clc
syms x
a=0
b=1
n=100
h=(b-a)/n
f=1/(sqrt(1+x^2))
suma=(subs(f,a)+subs(f,b))/2;
for k=1:n-1
xk=a+k*h;
suma=suma+subs(f,xk);
end
valorAproximado=double(suma*h)
valorReal=double(int(f,a,b))
ea=abs(valorReal-valorAproximado)
err=double(abs(-(((b-a)^3)/(12*(n^2)))*max(subs(diff(f,2),a),subs(diff(f,2),b))))
vectorX=a:0.01:b;
vectorY=subs(f,vectorX)
area(vectorX,vectorY)
prueba:
a =
1
b =
n =
100
h =
1/100
f =
1/(x^2 + 1)^(1/2)
valorAproximado =
1003/1138
valorReal =
847/961
ea =
1/339411
err =
1/678823
vectorY =
b)
script:
clear
clc
syms x
a=1
b=5/2
n=100
h=(b-a)/n
f=((x^2)+8)^1/3
suma=(subs(f,a)+subs(f,b))/2;
for k=1:n-1
xk=a+k*h;
suma=suma+subs(f,xk);
end
valorAproximado=double(suma*h)
valorReal=double(int(f,a,b))
ea=abs(valorReal-valorAproximado)
3
err=double(abs(-(((b-a)^3)/(12*(n^2)))*max(subs(diff(f,2),a),subs(diff(f,2),b))))
vectorX=a:0.01:b;
vectorY=subs(f,vectorX)
area(vectorX,vectorY)
prueba:
a =
b =
5/2
n =
100
h =
3/200
f =
x^2/3 + 8/3
valorAproximado =
37502/6667
valorReal =
45/8
ea =
4
3/160000
err =
3/160000
vectorY =
c)
script:
clear
clc
syms x
a=pi/2
b=3*pi/2
n=100
5
h=(b-a)/n
f=(sin(x)/x)
suma=(subs(f,a)+subs(f,b))/2;
for k=1:n-1
xk=a+k*h;
suma=suma+subs(f,xk);
end
valorAproximado=double(suma*h)
valorReal=double(int(f,a,b))
ea=abs(valorReal-valorAproximado)
err=double(abs(-(((b-a)^3)/(12*(n^2)))*max(subs(diff(f,2),a),subs(diff(f,2),b))))
vectorX=a:0.01:b;
vectorY=subs(f,vectorX)
area(vectorX,vectorY)
prueba:
a =
355/226
b =
1065/226
n =
100
h =
71/2260
f =
sin(x)/x
valorAproximado =
6
986/4149
valorReal =
537/2260
ea =
3/80999
err =
19/380816
vectorY =
[2/pi, (4503599627370496*sin(7119273748302145/4503599627370496))/7119273748302145,
(2251799813685248*sin(3582154872287925/2251799813685248))/3582154872287925,
(4503599627370496*sin(7209345740849555/4503599627370496))/7209345740849555,
(1125899906842624*sin(1813595434280815/1125899906842624))/1813595434280815,
(4503599627370496*sin(7299417733396965/4503599627370496))/7299417733396965,
(2251799813685248*sin(3672226864835335/2251799813685248))/3672226864835335,
(4503599627370496*sin(7389489725944375/4503599627370496))/7389489725944375,
(140737488355328*sin(232328928819315/140737488355328))/232328928819315,
(4503599627370496*sin(7479561718491785/4503599627370496))/7479561718491785,
(2251799813685248*sin(3762298857382745/2251799813685248))/3762298857382745,
(4503599627370496*sin(7569633711039195/4503599627370496))/7569633711039195,
(1125899906842624*sin(1903667426828225/1125899906842624))/1903667426828225,
(1125899906842624*sin(1914926425896651/1125899906842624))/1914926425896651,
(2251799813685248*sin(3852370849930155/2251799813685248))/3852370849930155,
(2251799813685248*sin(3874888848067007/2251799813685248))/3874888848067007,
(4503599627370496*sin(7794813692407719/4503599627370496))/7794813692407719,
(281474976710656*sin(489990605542589/281474976710656))/489990605542589,
(4503599627370496*sin(7884885684955129/4503599627370496))/7884885684955129,
(2251799813685248*sin(3964960840614417/2251799813685248))/3964960840614417,
(4503599627370496*sin(7974957677502539/4503599627370496))/7974957677502539,
(1125899906842624*sin(2004998418444061/1125899906842624))/2004998418444061,
(4503599627370496*sin(8065029670049949/4503599627370496))/8065029670049949,
(2251799813685248*sin(4055032833161827/2251799813685248))/4055032833161827,
7
(4503599627370496*sin(8155101662597359/4503599627370496))/8155101662597359,
(562949953421312*sin(1025017207358883/562949953421312))/1025017207358883,
(4503599627370496*sin(8245173655144769/4503599627370496))/8245173655144769,
(2251799813685248*sin(4145104825709237/2251799813685248))/4145104825709237,
(4503599627370496*sin(8335245647692179/4503599627370496))/8335245647692179,
(1125899906842624*sin(2095070410991471/1125899906842624))/2095070410991471,
(4503599627370496*sin(8425317640239589/4503599627370496))/8425317640239589,
(2251799813685248*sin(4235176818256647/2251799813685248))/4235176818256647,
(4503599627370496*sin(8515389632786999/4503599627370496))/8515389632786999,
(140737488355328*sin(267513300908147/140737488355328))/267513300908147,
(4503599627370496*sin(8605461625334409/4503599627370496))/8605461625334409,
(2251799813685248*sin(4325248810804057/2251799813685248))/4325248810804057,
(2251799813685248*sin(4347766808940909/2251799813685248))/4347766808940909,
(1125899906842624*sin(2185142403538881/1125899906842624))/2185142403538881,
(1125899906842624*sin(2196401402607307/1125899906842624))/2196401402607307,
(2251799813685248*sin(4415320803351467/2251799813685248))/4415320803351467,
(2251799813685248*sin(4437838801488319/2251799813685248))/4437838801488319,
(562949953421312*sin(1115089199906293/562949953421312))/1115089199906293,
(281474976710656*sin(560359349720253/281474976710656))/560359349720253,
(2251799813685248*sin(4505392795898877/2251799813685248))/4505392795898877,
(2251799813685248*sin(4527910794035729/2251799813685248))/4527910794035729,
(1125899906842624*sin(2275214396086291/1125899906842624))/2275214396086291,
(1125899906842624*sin(2286473395154717/1125899906842624))/2286473395154717,
(2251799813685248*sin(4595464788446287/2251799813685248))/4595464788446287,
(2251799813685248*sin(4617982786583139/2251799813685248))/4617982786583139,
(281474976710656*sin(580062598089999/281474976710656))/580062598089999,
(562949953421312*sin(1165754695714211/562949953421312))/1165754695714211,
(70368744177664*sin(146423024406053/70368744177664))/146423024406053,
(2251799813685248*sin(4708054779130549/2251799813685248))/4708054779130549,
(1125899906842624*sin(2365286388633701/1125899906842624))/2365286388633701,
(1125899906842624*sin(2376545387702127/1125899906842624))/2376545387702127,
(1125899906842624*sin(2387804386770553/1125899906842624))/2387804386770553,
(2251799813685248*sin(4798126771677959/2251799813685248))/4798126771677959,
(562949953421312*sin(1205161192453703/562949953421312))/1205161192453703,
(140737488355328*sin(302697672996979/140737488355328))/302697672996979,
(562949953421312*sin(1216420191522129/562949953421312))/1216420191522129,
(2251799813685248*sin(4888198764225369/2251799813685248))/4888198764225369,
(2251799813685248*sin(4910716762362221/2251799813685248))/4910716762362221,
(1125899906842624*sin(2466617380249537/1125899906842624))/2466617380249537,
(1125899906842624*sin(2477876379317963/1125899906842624))/2477876379317963,
(2251799813685248*sin(4978270756772779/2251799813685248))/4978270756772779,
8
(2251799813685248*sin(5000788754909631/2251799813685248))/5000788754909631,
(562949953421312*sin(1255826688261621/562949953421312))/1255826688261621,
(281474976710656*sin(630728093897917/281474976710656))/630728093897917,
(2251799813685248*sin(5068342749320189/2251799813685248))/5068342749320189,
(2251799813685248*sin(5090860747457041/2251799813685248))/5090860747457041,
(1125899906842624*sin(2556689372796947/1125899906842624))/2556689372796947,
(1125899906842624*sin(2567948371865373/1125899906842624))/2567948371865373,
(1125899906842624*sin(2579207370933799/1125899906842624))/2579207370933799,
(2251799813685248*sin(5180932740004451/2251799813685248))/5180932740004451,
(281474976710656*sin(650431342267663/281474976710656))/650431342267663,
(562949953421312*sin(1306492184069539/562949953421312))/1306492184069539,
(70368744177664*sin(164015210450469/70368744177664))/164015210450469,
(2251799813685248*sin(5271004732551861/2251799813685248))/5271004732551861,
(1125899906842624*sin(2646761365344357/1125899906842624))/2646761365344357,
(1125899906842624*sin(2658020364412783/1125899906842624))/2658020364412783,
(1125899906842624*sin(2669279363481209/1125899906842624))/2669279363481209,
(2251799813685248*sin(5361076725099271/2251799813685248))/5361076725099271,
(562949953421312*sin(1345898680809031/562949953421312))/1345898680809031,
(140737488355328*sin(337882045085811/140737488355328))/337882045085811,
(562949953421312*sin(1357157679877457/562949953421312))/1357157679877457,
(2251799813685248*sin(5451148717646681/2251799813685248))/5451148717646681,
(2251799813685248*sin(5473666715783533/2251799813685248))/5473666715783533,
(1125899906842624*sin(2748092356960193/1125899906842624))/2748092356960193,
(1125899906842624*sin(2759351356028619/1125899906842624))/2759351356028619,
(2251799813685248*sin(5541220710194091/2251799813685248))/5541220710194091,
(2251799813685248*sin(5563738708330943/2251799813685248))/5563738708330943,
(562949953421312*sin(1396564176616949/562949953421312))/1396564176616949,
(281474976710656*sin(701096838075581/281474976710656))/701096838075581,
(2251799813685248*sin(5631292702741501/2251799813685248))/5631292702741501,
(2251799813685248*sin(5653810700878353/2251799813685248))/5653810700878353,
(1125899906842624*sin(2838164349507603/1125899906842624))/2838164349507603,
(1125899906842624*sin(2849423348576029/1125899906842624))/2849423348576029,
(1125899906842624*sin(2860682347644455/1125899906842624))/2860682347644455,
(2251799813685248*sin(5743882693425763/2251799813685248))/5743882693425763,
(281474976710656*sin(720800086445327/281474976710656))/720800086445327,
(562949953421312*sin(1447229672424867/562949953421312))/1447229672424867,
(70368744177664*sin(181607396494885/70368744177664))/181607396494885,
(2251799813685248*sin(5833954685973173/2251799813685248))/5833954685973173,
(1125899906842624*sin(2928236342055013/1125899906842624))/2928236342055013,
(1125899906842624*sin(2939495341123439/1125899906842624))/2939495341123439,
(1125899906842624*sin(2950754340191865/1125899906842624))/2950754340191865,
9
(2251799813685248*sin(5924026678520583/2251799813685248))/5924026678520583,
(562949953421312*sin(1486636169164359/562949953421312))/1486636169164359,
(140737488355328*sin(373066417174643/140737488355328))/373066417174643,
(562949953421312*sin(1497895168232785/562949953421312))/1497895168232785,
(2251799813685248*sin(6014098671067993/2251799813685248))/6014098671067993,
(1125899906842624*sin(3018308334602423/1125899906842624))/3018308334602423,
(1125899906842624*sin(3029567333670849/1125899906842624))/3029567333670849,
(1125899906842624*sin(3040826332739275/1125899906842624))/3040826332739275,
(2251799813685248*sin(6104170663615403/2251799813685248))/6104170663615403,
(35184372088832*sin(95729510339879/35184372088832))/95729510339879,
(562949953421312*sin(1537301664972277/56294995
3421312))/1537301664972277,
(281474976710656*sin(771465582253245/281474976710656))/771465582253245,
(562949953421312*sin(1548560664040703/562949953421312))/1548560664040703,
(2251799813685248*sin(6216760654299665/2251799813685248))/6216760654299665,
(1125899906842624*sin(3119639326218259/1125899906842624))/3119639326218259,
(1125899906842624*sin(3130898325286685/1125899906842624))/3130898325286685,
(1125899906842624*sin(3142157324355111/1125899906842624))/3142157324355111,
(2251799813685248*sin(6306832646847075/2251799813685248))/6306832646847075,
(281474976710656*sin(791168830622991/281474976710656))/791168830622991,
(562949953421312*sin(1587967160780195/562949953421312))/1587967160780195,
(70368744177664*sin(199199582539301/70368744177664))/199199582539301,
(2251799813685248*sin(6396904639394485/2251799813685248))/6396904639394485,
(1125899906842624*sin(3209711318765669/1125899906842624))/3209711318765669,
(1125899906842624*sin(3220970317834095/1125899906842624))/3220970317834095,
(1125899906842624*sin(3232229316902521/1125899906842624))/3232229316902521,
(2251799813685248*sin(6486976631941895/2251799813685248))/6486976631941895,
(562949953421312*sin(1627373657519687/562949953421312))/1627373657519687,
(140737488355328*sin(408250789263475/140737488355328))/408250789263475,
(562949953421312*sin(1638632656588113/562949953421312))/1638632656588113,
(2251799813685248*sin(6577048624489305/2251799813685248))/6577048624489305,
(1125899906842624*sin(3299783311313079/1125899906842624))/3299783311313079,
(1125899906842624*sin(3311042310381505/1125899906842624))/3311042310381505,
(1125899906842624*sin(3322301309449931/1125899906842624))/3322301309449931,
(2251799813685248*sin(6667120617036715/2251799813685248))/6667120617036715,
(35184372088832*sin(104525603362087/35184372088832))/104525603362087,
(562949953421312*sin(1678039153327605/562949953421312))/1678039153327605,
(281474976710656*sin(841834326430909/281474976710656))/841834326430909,
(562949953421312*sin(1689298152396031/562949953421312))/1689298152396031,
(2251799813685248*sin(6779710607720977/2251799813685248))/6779710607720977,
(1125899906842624*sin(3401114302928915/1125899906842624))/3401114302928915,
(1125899906842624*sin(3412373301997341/1125899906842624))/3412373301997341,
(1125899906842624*sin(3423632301065767/1125899906842624))/3423632301065767,
10
(2251799813685248*sin(6869782600268387/2251799813685248))/6869782600268387,
(281474976710656*sin(861537574800655/281474976710656))/861537574800655,
(562949953421312*sin(1728704649135523/562949953421312))/1728704649135523,
(70368744177664*sin(216791768583717/70368744177664))/216791768583717,
(2251799813685248*sin(6959854592815797/2251799813685248))/6959854592815797,
(1125899906842624*sin(3491186295476325/1125899906842624))/3491186295476325,
(1125899906842624*sin(3502445294544751/1125899906842624))/3502445294544751,
(1125899906842624*sin(3513704293613177/1125899906842624))/3513704293613177,
(2251799813685248*sin(7049926585363207/2251799813685248))/7049926585363207,
(562949953421312*sin(1768111145875015/562949953421312))/1768111145875015,
(2251799813685248*sin(7094962581636913/2251799813685248))/7094962581636913,
(1125899906842624*sin(3558740289886883/1125899906842624))/3558740289886883,
(1125899906842624*sin(3569999288955309/1125899906842624))/3569999288955309,
(1125899906842624*sin(3581258288023735/1125899906842624))/3581258288023735,
(2251799813685248*sin(7185034574184323/2251799813685248))/7185034574184323,
(281474976710656*sin(900944071540147/281474976710656))/900944071540147,
(562949953421312*sin(1807517642614507/562949953421312))/1807517642614507,
(35184372088832*sin(113321696384295/35184372088832))/113321696384295,
(2251799813685248*sin(7275106566731733/2251799813685248))/7275106566731733,
(1125899906842624*sin(3648812282434293/1125899906842624))/3648812282434293,
(1125899906842624*sin(3660071281502719/1125899906842624))/3660071281502719,
(1125899906842624*sin(3671330280571145/1125899906842624))/3671330280571145,
(2251799813685248*sin(7365178559279143/2251799813685248))/7365178559279143,
(562949953421312*sin(1846924139353999/562949953421312))/1846924139353999,
(140737488355328*sin(463138409722053/140737488355328))/463138409722053,
(562949953421312*sin(1858183138422425/562949953421312))/1858183138422425,
(281474976710656*sin(931906318978319/281474976710656))/931906318978319,
(2251799813685248*sin(7477768549963405/2251799813685248))/7477768549963405,
(1125899906842624*sin(3750143274050129/1125899906842624))/3750143274050129,
(1125899906842624*sin(3761402273118555/1125899906842624))/3761402273118555,
(1125899906842624*sin(3772661272186981/1125899906842624))/3772661272186981,
(2251799813685248*sin(7567840542510815/2251799813685248))/7567840542510815,
(562949953421312*sin(1897589635161917/562949953421312))/1897589635161917,
(281474976710656*sin(951609567348065/281474976710656))/951609567348065,
(562949953421312*sin(1908848634230343/562949953421312))/1908848634230343,
(2251799813685248*sin(7657912535058225/2251799813685248))/7657912535058225,
(1125899906842624*sin(3840215266597539/1125899906842624))/3840215266597539,
(1125899906842624*sin(3851474265665965/1125899906842624))/3851474265665965,
(1125899906842624*sin(3862733264734391/1125899906842624))/3862733264734391,
(2251799813685248*sin(7747984527605635/2251799813685248))/7747984527605635,
(281474976710656*sin(971312815717811/281474976710656))/971312815717811,
11
(562949953421312*sin(1948255130969835/562949953421312))/1948255130969835,
(35184372088832*sin(122117789406503/35184372088832))/122117789406503,
(2251799813685248*sin(7838056520153045/2251799813685248))/7838056520153045,
(1125899906842624*sin(3930287259144949/1125899906842624))/3930287259144949,
(1125899906842624*sin(3941546258213375/1125899906842624))/3941546258213375,
(1125899906842624*sin(3952805257281801/1125899906842624))/3952805257281801,
(2251799813685248*sin(7928128512700455/2251799813685248))/7928128512700455,
(562949953421312*sin(1987661627709327/562949953421312))/1987661627709327,
(140737488355328*sin(498322781810885/140737488355328))/498322781810885,
(562949953421312*sin(1998920626777753/562949953421312))/1998920626777753,
(281474976710656*sin(1002275063155983/281474976710656))/1002275063155983,
(2251799813685248*sin(8040718503384717/2251799813685248))/8040718503384717,
(1125899906842624*sin(4031618250760785/1125899906842624))/4031618250760785,
(1125899906842624*sin(4042877249829211/1125899906842624))/4042877249829211,
(1125899906842624*sin(4054136248897637/1125899906842624))/4054136248897637,
(2251799813685248*sin(8130790495932127/2251799813685248))/8130790495932127,
(562949953421312*sin(2038327123517245/562949953421312))/2038327123517245,
(281474976710656*sin(1021978311525729/281474976710656))/1021978311525729,
(562949953421312*sin(2049586122585671/562949953421312))/2049586122585671,
(2251799813685248*sin(8220862488479537/2251799813685248))/8220862488479537,
(1125899906842624*sin(4121690243308195/1125899906842624))/4121690243308195,
(1125899906842624*sin(4132949242376621/1125899906842624))/4132949242376621,
(1125899906842624*sin(4144208241445047/1125899906842624))/4144208241445047,
(2251799813685248*sin(8310934481026947/2251799813685248))/8310934481026947,
(281474976710656*sin(1041681559895475/281474976710656))/1041681559895475,
(562949953421312*sin(2088992619325163/562949953421312))/2088992619325163,
(35184372088832*sin(130913882428711/35184372088832))/130913882428711,
(2251799813685248*sin(8401006473574357/2251799813685248))/8401006473574357,
(1125899906842624*sin(4211762235855605/1125899906842624))/4211762235855605,
(1125899906842624*sin(4223021234924031/1125899906842624))/4223021234924031,
(1125899906842624*sin(4234280233992457/1125899906842624))/4234280233992457,
(2251799813685248*sin(8491078466121767/2251799813685248))/8491078466121767,
(2251799813685248*sin(8513596464258619/2251799813685248))/8513596464258619,
(140737488355328*sin(533507153899717/140737488355328))/533507153899717,
(562949953421312*sin(2139658115133081/562949953421312))/2139658115133081,
(2251799813685248*sin(8581150458669177/2251799813685248))/8581150458669177,
(2251799813685248*sin(8603668456806029/2251799813685248))/8603668456806029,
(1125899906842624*sin(4313093227471441/1125899906842624))/4313093227471441,
(1125899906842624*sin(4324352226539867/1125899906842624))/4324352226539867,
(2251799813685248*sin(8671222451216587/2251799813685248))/8671222451216587,
(2251799813685248*sin(8693740449353439/2251799813685248))/8693740449353439,
(562949953421312*sin(2179064611872573/562949953421312))/2179064611872573,
(281474976710656*sin(1092347055703393/281474976710656))/1092347055703393,
(562949953421312*sin(2190323610940999/562949953421312))/2190323610940999,
12
(2251799813685248*sin(8783812441900849/2251799813685248))/8783812441900849,
(1125899906842624*sin(4403165220018851/1125899906842624))/4403165220018851,
(1125899906842624*sin(4414424219087277/1125899906842624))/4414424219087277,
(1125899906842624*sin(4425683218155703/1125899906842624))/4425683218155703,
(2251799813685248*sin(8873884434448259/2251799813685248))/8873884434448259,
(281474976710656*sin(1112050304073139/281474976710656))/1112050304073139,
(562949953421312*sin(2229730107680491/562949953421312))/2229730107680491,
(35184372088832*sin(139709975450919/35184372088832))/139709975450919,
(2251799813685248*sin(8963956426995669/2251799813685248))/8963956426995669,
(1125899906842624*sin(4493237212566261/1125899906842624))/4493237212566261,
(1125899906842624*sin(4504496211634687/1125899906842624))/4504496211634687,
(1125899906842624*sin(4515755210703113/1125899906842624))/4515755210703113,
(1125899906842624*sin(4527014209771539/1125899906842624))/4527014209771539,
(562949953421312*sin(2269136604419983/562949953421312))/2269136604419983,
(140737488355328*sin(568691525988549/140737488355328))/568691525988549,
(562949953421312*sin(2280395603488409/562949953421312))/2280395603488409,
(281474976710656*sin(1143012551511311/281474976710656))/1143012551511311,
(1125899906842624*sin(4583309205113671/1125899906842624))/4583309205113671,
(1125899906842624*sin(4594568204182097/1125899906842624))/4594568204182097,
(1125899906842624*sin(4605827203250523/1125899906842624))/4605827203250523,
(1125899906842624*sin(4617086202318949/1125899906842624))/4617086202318949,
(70368744177664*sin(289271575086711/70368744177664))/289271575086711,
(562949953421312*sin(2319802100227901/562949953421312))/2319802100227901,
(281474976710656*sin(1162715799881057/281474976710656))/1162715799881057,
(562949953421312*sin(2331061099296327/562949953421312))/2331061099296327,
(140737488355328*sin(584172649707635/140737488355328))/584172649707635,
(1125899906842624*sin(4684640196729507/1125899906842624))/4684640196729507,
(1125899906842624*sin(4695899195797933/1125899906842624))/4695899195797933,
(1125899906842624*sin(4707158194866359/1125899906842624))/4707158194866359,
(562949953421312*sin(2359208596967393/562949953421312))/2359208596967393,
(281474976710656*sin(1182419048250803/281474976710656))/1182419048250803,
(562949953421312*sin(2370467596035819/562949953421312))/2370467596035819,
(35184372088832*sin(148506068473127/35184372088832))/148506068473127,
(562949953421312*sin(2381726595104245/562949953421312))/2381726595104245,
(1125899906842624*sin(4774712189276917/1125899906842624))/4774712189276917,
(1125899906842624*sin(4785971188345343/1125899906842624))/4785971188345343,
(1125899906842624*sin(4797230187413769/1125899906842624))/4797230187413769,
(1125899906842624*sin(4808489186482195/1125899906842624))/4808489186482195,
(562949953421312*sin(2409874092775311/562949953421312))/2409874092775311,
(140737488355328*sin(603875898077381/140737488355328))/603875898077381,
(562949953421312*sin(2421133091843737/562949953421312))/2421133091843737,
(281474976710656*sin(1213381295688975/281474976710656))/1213381295688975,
(1125899906842624*sin(4864784181824327/1125899906842624))/4864784181824327,
(1125899906842624*sin(4876043180892753/1125899906842624))/4876043180892753,
13
(1125899906842624*sin(4887302179961179/1125899906842624))/4887302179961179,
(1125899906842624*sin(4898561179029605/1125899906842624))/4898561179029605,
(70368744177664*sin(306863761131127/70368744177664))/306863761131127,
(562949953421312*sin(2460539588583229/562949953421312))/2460539588583229,
(281474976710656*sin(1233084544058721/281474976710656))/1233084544058721,
(562949953421312*sin(2471798587651655/562949953421312))/2471798587651655,
(1125899906842624*sin(4954856174371737/1125899906842624))/4954856174371737,
(1125899906842624*sin(4966115173440163/1125899906842624))/4966115173440163,
(1125899906842624*sin(4977374172508589/1125899906842624))/4977374172508589,
(1125899906842624*sin(4988633171577015/1125899906842624))/4988633171577015,
(562949953421312*sin(2499946085322721/562949953421312))/2499946085322721,
(281474976710656*sin(1252787792428467/281474976710656))/1252787792428467,
(562949953421312*sin(2511205084391147/562949953421312))/2511205084391147,
(35184372088832*sin(157302161495335/35184372088832))/157302161495335,
(562949953421312*sin(2522464083459573/562949953421312))/2522464083459573,
(1125899906842624*sin(5056187165987573/1125899906842624))/5056187165987573,
(1125899906842624*sin(5067446165055999/1125899906842624))/5067446165055999,
(1125899906842624*sin(5078705164124425/1125899906842624))/5078705164124425,
(1125899906842624*sin(5089964163192851/1125899906842624))/5089964163192851,
(562949953421312*sin(2550611581130639/562949953421312))/2550611581130639,
(140737488355328*sin(639060270166213/140737488355328))/639060270166213,
(562949953421312*sin(2561870580199065/562949953421312))/2561870580199065,
(281474976710656*sin(1283750039866639/281474976710656))/1283750039866639,
(1125899906842624*sin(5146259158534983/1125899906842624))/5146259158534983,
(1125899906842624*sin(5157518157603409/1125899906842624))/5157518157603409,
(1125899906842624*sin(5168777156671835/1125899906842624))/5168777156671835,
(1125899906842624*sin(5180036155740261/1125899906842624))/5180036155740261,
(70368744177664*sin(324455947175543/70368744177664))/324455947175543,
(562949953421312*sin(2601277076938557/562949953421312))/2601277076938557,
(281474976710656*sin(1303453288236385/281474976710656))/1303453288236385,
(562949953421312*sin(2612536076006983/562949953421312))/2612536076006983,
(1125899906842624*sin(5236331151082393/1125899906842624))/5236331151082393,
(1125899906842624*sin(5247590150150819/1125899906842624))/5247590150150819,
(1125899906842624*sin(5258849149219245/1125899906842624))/5258849149219245,
(1125899906842624*sin(5270108148287671/1125899906842624))/5270108148287671,
(562949953421312*sin(2640683573678049/562949953421312))/2640683573678049,
(281474976710656*sin(1323156536606131/281474976710656))/1323156536606131,
(562949953421312*sin(2651942572746475/562949953421312))/2651942572746475]
d)
script:
clear
14
clc
syms x
a=1
b=1.8
n=100
h=(b-a)/n
f=sqrt(1+x^3)
suma=(subs(f,a)+subs(f,b))/2;
for k=1:n-1
xk=a+k*h;
suma=suma+subs(f,xk);
end
valorAproximado=double(suma*h)
valorReal=double(int(f,a,b))
ea=abs(valorReal-valorAproximado)
err=double(abs(-(((b-a)^3)/(12*(n^2)))*max(subs(diff(f,2),a),subs(diff(f,2),b))))
vectorX=a:0.01:b;
vectorY=subs(f,vectorX)
area(vectorX,vectorY)
prueba:
a =
b =
9/5
n =
100
h =
1/125
f =
(x^3 + 1)^(1/2)
15
valorAproximado =
2173/1385
valorReal =
1627/1037 -
1/883423532389192164791648750371459257913741948437809479060803100646309888i
ea =
1/234758
err =
3/530330
vectorY =
prueba:
f =
1/(x^2 + 1)^(1/2)
a =
17
b =
n =
900
h =
1/900
valorAprox =
847/961
valorReal =
847/961
ea =
1/200159983438689
errorFormula =
1/5832000000000
b)
script:
clear
clc
syms x
f=((x^2)+8)^1/3
18
a=1
b=5/2
n=900
h=(b-a)/n
sumatoria=subs(f,a)+subs(f,b);
for i=1:n-1
if(mod(i,3)==0)
sumatoria=sumatoria+2*subs(f,a+i*h);
else
sumatoria=sumatoria+3*subs(f,a+i*h);
end
end
sumatoria=double(sumatoria*(3*h)/8);
valorAprox=sumatoria
valorReal=double(int(f,a,b))
ea=double(abs(valorReal-valorAprox))
vectorX=a:0.01:b;
vectorY=subs(f,vectorX);
area(vectorX,vectorY)
errorFormula=double(((n/80)*(h^5))*max(subs(diff(f,4),a),...
subs(diff(f,4),b)))
prueba:
f =
x^2/3 + 8/3
a =
b =
5/2
n =
900
h =
1/600
19
valorAprox =
45/8
valorReal =
45/8
ea =
errorFormula =
c)
script:
clear
clc
syms x
f=(sin(x))/x
a=pi/2
b=3*pi/2
n=900
h=(b-a)/n
sumatoria=subs(f,a)+subs(f,b);
for i=1:n-1
if(mod(i,3)==0)
sumatoria=sumatoria+2*subs(f,a+i*h);
else
sumatoria=sumatoria+3*subs(f,a+i*h);
end
end
sumatoria=double(sumatoria*(3*h)/8);
valorAprox=sumatoria
valorReal=double(int(f,a,b))
ea=double(abs(valorReal-valorAprox))
vectorX=a:0.01:b;
vectorY=subs(f,vectorX);
area(vectorX,vectorY)
errorFormula=double(((n/80)*(h^5))*max(subs(diff(f,4),a),...
subs(diff(f,4),b)))
20
prueba:
f =
sin(x)/x
a =
355/226
b =
1065/226
n =
900
h =
71/20340
valorAprox =
537/2260
valorReal =
537/2260
ea =
1/1525351270913
errorFormula =
21
1/3422499601867
d)
script:
clear
clc
syms x
f=sqrt(1+x^3)
a=1
b=1.8
n=900
h=(b-a)/n
sumatoria=subs(f,a)+subs(f,b);
for i=1:n-1
if(mod(i,3)==0)
sumatoria=sumatoria+2*subs(f,a+i*h);
else
sumatoria=sumatoria+3*subs(f,a+i*h);
end
end
sumatoria=double(sumatoria*(3*h)/8);
valorAprox=sumatoria
valorReal=double(int(f,a,b))
ea=double(abs(valorReal-valorAprox))
vectorX=a:0.01:b;
vectorY=subs(f,vectorX);
area(vectorX,vectorY)
errorFormula=double(((n/80)*(h^5))*max(subs(diff(f,4),a),...
subs(diff(f,4),b)))
prueba:
f =
(x^3 + 1)^(1/2)
a =
b =
9/5
22
n =
900
h =
1/1125
valorAprox =
1627/1037
valorReal =
1627/1037 -
1/883423532389192164791648750371459257913741948437809479060803100646309888i
ea =
1/300239975158033
errorFormula =
1/261075338885319
gauss legendre
a)
script:
clear
clc
syms x
format long
f=1/sqrt(1+x^2)
a=0
b=1
n=5
23
switch n
case 1
xi=[0]
wi=[2]
case 2
xi=[-sqrt(1/3) sqrt(1/3)]
wi=[1 1]
case 3
xi=[-sqrt(3/5) 0 sqrt(3/5)]
wi=[5/9 8/9 5/9]
case 4
xi=[-sqrt((3-2*sqrt(6/5))/7), sqrt((3-2*sqrt(6/5))/7),
-sqrt((3+2*sqrt(6/5))/7),sqrt((3+2*sqrt(6/5))/7)]
wi=[(18+sqrt(30))/36, (18+sqrt(30))/36, (18-sqrt(30))/36, (18-sqrt(30))/36]
case 5
xi=[0, -(1/3)*sqrt(5-2*sqrt(10/7)), (1/3)*sqrt(5-2*sqrt(10/7)), -(1/3)*sqrt(5+2*sqrt(10/7)),
(1/3)*sqrt(5+2*sqrt(10/7))]
wi=[128/225, (322+13*sqrt(70))/900,(322+13*sqrt(70))/900, (322-13*sqrt(70))/900, (322-
13*sqrt(70))/900]
otherwise
disp('Valor de n incorrecto.');
end
n
suma=0;
for i=1:n
suma=suma+wi(i)*subs(f,(((b-a)/2)*xi(i))+(a+b)/2);
end
valorAprox=double(suma*(b-a)/2)
valorReal=double(int(f,a,b))
ea=double(abs(valorReal-valorAprox))
vectorX=a:0.01:b;
vectorY=subs(f,vectorX);
area(vectorX,vectorY)
prueba:
f =
1/(x^2 + 1)^(1/2)
a =
b =
1
24
n =
xi =
Columns 1 through 3
0 -0.538469310105683 0.538469310105683
Columns 4 through 5
-0.906179845938664 0.906179845938664
wi =
Columns 1 through 3
Columns 4 through 5
0.236926885056189 0.236926885056189
n =
valorAprox =
0.881373570698726
valorReal =
0.881373587019543
25
ea =
1.632081725322365e-08
b)
script:
clear
clc
syms x
format long
f=(x^2+8)^(1/3)
a=1
b=5/2
n=5
switch n
case 1
xi=[0]
wi=[2]
case 2
xi=[-sqrt(1/3) sqrt(1/3)]
wi=[1 1]
case 3
xi=[-sqrt(3/5) 0 sqrt(3/5)]
wi=[5/9 8/9 5/9]
case 4
xi=[-sqrt((3-2*sqrt(6/5))/7), sqrt((3-2*sqrt(6/5))/7),
-sqrt((3+2*sqrt(6/5))/7),sqrt((3+2*sqrt(6/5))/7)]
wi=[(18+sqrt(30))/36, (18+sqrt(30))/36, (18-sqrt(30))/36, (18-sqrt(30))/36]
case 5
xi=[0, -(1/3)*sqrt(5-2*sqrt(10/7)), (1/3)*sqrt(5-2*sqrt(10/7)), -(1/3)*sqrt(5+2*sqrt(10/7)),
(1/3)*sqrt(5+2*sqrt(10/7))]
wi=[128/225, (322+13*sqrt(70))/900,(322+13*sqrt(70))/900, (322-13*sqrt(70))/900, (322-
13*sqrt(70))/900]
otherwise
disp('Valor de n incorrecto.');
end
n
suma=0;
for i=1:n
suma=suma+wi(i)*subs(f,(((b-a)/2)*xi(i))+(a+b)/2);
end
valorAprox=double(suma*(b-a)/2)
valorReal=double(int(f,a,b))
ea=double(abs(valorReal-valorAprox))
vectorX=a:0.01:b;
vectorY=subs(f,vectorX);
area(vectorX,vectorY)
prueba:
26
f =
(x^2 + 8)^(1/3)
a =
b =
2.500000000000000
n =
xi =
Columns 1 through 3
0 -0.538469310105683 0.538469310105683
Columns 4 through 5
-0.906179845938664 0.906179845938664
wi =
Columns 1 through 3
Columns 4 through 5
0.236926885056189 0.236926885056189
n =
27
5
valorAprox =
3.354260820897378
valorReal =
3.354260820920480
ea =
2.310196478561011e-11
c)
script:
clear
clc
syms x
format long
f=(sin(x)/x)
a=pi/2
b=3*pi/2
n=5
switch n
case 1
xi=[0]
wi=[2]
case 2
xi=[-sqrt(1/3) sqrt(1/3)]
wi=[1 1]
case 3
xi=[-sqrt(3/5) 0 sqrt(3/5)]
wi=[5/9 8/9 5/9]
case 4
xi=[-sqrt((3-2*sqrt(6/5))/7), sqrt((3-2*sqrt(6/5))/7),
-sqrt((3+2*sqrt(6/5))/7),sqrt((3+2*sqrt(6/5))/7)]
wi=[(18+sqrt(30))/36, (18+sqrt(30))/36, (18-sqrt(30))/36, (18-sqrt(30))/36]
case 5
xi=[0, -(1/3)*sqrt(5-2*sqrt(10/7)), (1/3)*sqrt(5-2*sqrt(10/7)), -(1/3)*sqrt(5+2*sqrt(10/7)),
(1/3)*sqrt(5+2*sqrt(10/7))]
28
wi=[128/225, (322+13*sqrt(70))/900,(322+13*sqrt(70))/900, (322-13*sqrt(70))/900, (322-
13*sqrt(70))/900]
otherwise
disp('Valor de n incorrecto.');
end
n
suma=0;
for i=1:n
suma=suma+wi(i)*subs(f,(((b-a)/2)*xi(i))+(a+b)/2);
end
valorAprox=double(suma*(b-a)/2)
valorReal=double(int(f,a,b))
ea=double(abs(valorReal-valorAprox))
vectorX=a:0.01:b;
vectorY=subs(f,vectorX);
area(vectorX,vectorY)
prueba:
f =
sin(x)/x
a =
1.570796326794897
b =
4.712388980384690
n =
xi =
Columns 1 through 3
0 -0.538469310105683 0.538469310105683
29
Columns 4 through 5
-0.906179845938664 0.906179845938664
wi =
Columns 1 through 3
Columns 4 through 5
0.236926885056189 0.236926885056189
n =
valorAprox =
0.237610576311203
valorReal =
0.237610585799522
ea =
9.488319602235507e-09
d)
script:
clear
clc
syms x
format long
f=sqrt(1+x^3)
a=1
b=1.8
30
n=5
switch n
case 1
xi=[0]
wi=[2]
case 2
xi=[-sqrt(1/3) sqrt(1/3)]
wi=[1 1]
case 3
xi=[-sqrt(3/5) 0 sqrt(3/5)]
wi=[5/9 8/9 5/9]
case 4
xi=[-sqrt((3-2*sqrt(6/5))/7), sqrt((3-2*sqrt(6/5))/7),
-sqrt((3+2*sqrt(6/5))/7),sqrt((3+2*sqrt(6/5))/7)]
wi=[(18+sqrt(30))/36, (18+sqrt(30))/36, (18-sqrt(30))/36, (18-sqrt(30))/36]
case 5
xi=[0, -(1/3)*sqrt(5-2*sqrt(10/7)), (1/3)*sqrt(5-2*sqrt(10/7)), -(1/3)*sqrt(5+2*sqrt(10/7)),
(1/3)*sqrt(5+2*sqrt(10/7))]
wi=[128/225, (322+13*sqrt(70))/900,(322+13*sqrt(70))/900, (322-13*sqrt(70))/900, (322-
13*sqrt(70))/900]
otherwise
disp('Valor de n incorrecto.');
end
n
suma=0;
for i=1:n
suma=suma+wi(i)*subs(f,(((b-a)/2)*xi(i))+(a+b)/2);
end
valorAprox=double(suma*(b-a)/2)
valorReal=double(int(f,a,b))
ea=double(abs(valorReal-valorAprox))
vectorX=a:0.01:b;
vectorY=subs(f,vectorX);
area(vectorX,vectorY)
prueba:
f =
(x^3 + 1)^(1/2)
a =
b =
31
1.800000000000000
n =
xi =
Columns 1 through 3
0 -0.538469310105683 0.538469310105683
Columns 4 through 5
-0.906179845938664 0.906179845938664
wi =
Columns 1 through 3
Columns 4 through 5
0.236926885056189 0.236926885056189
n =
valorAprox =
1.568948927373802
valorReal =
1.568948927723797 - 0.000000000000000i
32
ea =
3.499953660224264e-10
X 3 5 7 9 10
Y 5 8 3 9 15
33
for i=1:j-2
productoria=productoria*(x-equis(i));
end
sumatoria=sumatoria+diferencias(j)*productoria;
end
sumatoria
modelo=simplify(sumatoria)
ezplot(modelo)
hold on
plot(equis,y,'r*')
prueba:
M =
Columns 1 through 3
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
Columns 4 through 6
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
M =
Columns 1 through 3
3 0 0
5 0 0
7 0 0
9 0 0
10 0 0
Columns 4 through 6
0 0 0
0 0 0
0 0 0
0 0 0
34
0 0 0
M =
Columns 1 through 3
3 5 0
5 8 0
7 3 0
9 9 0
10 15 0
Columns 4 through 6
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
M(1,3)=(M(2,2)-M(1,2))/(M(2,1)-M(1,1))
M(2,3)=(M(3,2)-M(2,2))/(M(3,1)-M(2,1))
M(3,3)=(M(4,2)-M(3,2))/(M(4,1)-M(3,1))
M(4,3)=(M(5,2)-M(4,2))/(M(5,1)-M(4,1))
M(1,4)=(M(2,3)-M(1,3))/(M(3,1)-M(1,1))
M(2,4)=(M(3,3)-M(2,3))/(M(4,1)-M(2,1))
M(3,4)=(M(4,3)-M(3,3))/(M(5,1)-M(3,1))
M(1,5)=(M(2,4)-M(1,4))/(M(4,1)-M(1,1))
M(2,5)=(M(3,4)-M(2,4))/(M(5,1)-M(2,1))
M(1,6)=(M(2,5)-M(1,5))/(M(5,1)-M(1,1))
M =
Columns 1 through 3
3 5 3/2
5 8 -5/2
7 3 3
9 9 6
10 15 0
Columns 4 through 6
-1 19/48 -113/1680
35
11/8 -3/40 0
1 0 0
0 0 0
0 0 0
diferencias =
Columns 1 through 3
3 5 3/2
Columns 4 through 6
-1 19/48 -113/1680
sumatoria =
modelo =
grafica:
36
3. Dado los siguientes puntos:
X 1 2 3 4
Y 2 1 5 4
end
modelo
ezplot(modelo)
hold on
plot(equis,ye,'r*')
prueba:
equis =
Columns 1 through 3
1 2 3
Column 4
ye =
Columns 1 through 3
2 1 5
Column 4
n =
V =
Columns 1 through 3
38
1 1 1
1 2 4
1 3 9
1 4 16
Column 4
1
8
27
64
inversa =
Columns 1 through 3
4 -6 4
-13/3 19/2 -7
3/2 -4 7/2
-1/6 1/2 -1/2
Column 4
-1
11/6
-1
1/6
b =
2
1
5
4
solucion =
18
-161/6
25/2
39
-5/3
modelo =
Grafica:
X 3 5 7 9 10
Y 5 8 3 9 15
40
n=length(equis);
sumatoria=0;
for i=1:n
productoria=1;
for j=1:n
if(j~=i)
productoria=productoria*((x-equis(j))/(equis(i)-equis(j)));
end
end
sumatoria=sumatoria+ye(i)*productoria;
end
sumatoria
modelo=simplify(sumatoria)
ezplot(modelo)
prueba:
sumatoria =
modelo =
grafica:
41
5. Usar el Método de Doolittle para resolver:
4 a+2 b+ c=1
2 a+2 b=2
a+3 c =3
Script:
format rat
clc
syms y1
syms y2
syms y3
tic
A=[4 2 1; 2 2 0; 1 0 3]
a=1/2;
b=1/4;
c=-1/2;
d=4;
e=2;
f=1;
g=1;
h=-1/2;
i=5/2;
L=[1 0 0; a 1 0; b c 1]
U=[d e f; 0 g h; 0 0 i]
A
R=L*U
y=[y1;y2;y3]
L*y
b=[10 20 30]
b=b'
y=inv(L)*b
x=inv(U)*y
for i=1:length(x)
fprintf('el valor de x%d es %d \n',i,x(i));
end
toc
prueba:
A =
4 2 1
2 2 0
1 0 3
42
L =
1 0 0
1/2 1 0
1/4 -1/2 1
U =
4 2 1
0 1 -1/2
0 0 5/2
A =
4 2 1
2 2 0
1 0 3
R =
4 2 1
2 2 0
1 0 3
y =
y1
y2
y3
ans =
y1
y1/2 + y2
y1/4 - y2/2 + y3
43
b =
10 20 30
b =
10
20
30
y =
10
15
35
x =
-12
22
14
el valor de x1 es -12
el valor de x2 es 22
el valor de x3 es 14
Elapsed time is 0.076164 seconds.
a+ 2b+ 3 c=4
2 a−3 b−c=−3
2 a+b+2 c=3
Script:
format rat
clc
A=[1 2 3; 2 -3 -1; 2 1 2]
a=2/3;
b=1/3;
44
c=-1;
d=3;
e=-1;
f=2;
g=-7/3;
h=-1/3;
i=1;
L=[a 0 0; b c 0; d e f]
U=[1 g h; 0 1 i; 0 0 1]
A
R=L*U
b=[4 -3 3]
b=b'
y=inv(L)*b
x=inv(U)*y
for i=1:length(x)
fprintf('Los valores de x%i=%d \n',i,x(i) );
end
prueba:
A =
1 2 3
2 -3 -1
2 1 2
L =
2/3 0 0
1/3 -1 0
3 -1 2
U =
1 -7/3 -1/3
0 1 1
0 0 1
A =
1 2 3
2 -3 -1
45
2 1 2
R =
3 -8 0
b =
4 -3 3
b =
4
-3
3
y =
6
5
-5
x =
83/3
10
-5
46
7. Usar el Método de Jacobi para resolver:
15 a+2 b−c=200
2 a+12 b+ z=−250
a+2 b+8 c=30
Valores iniciales: a 0=0 , b0 =0 , c 0=0 , tolerancia=10−3
Script:
clear
clc
syms x
syms y
syms z
%Ecuaciones
fx=(200-2*y+z)/15
fy=(-250-2*x-z)/12
fz=(30-x-2*y)/8
%Valores iniciales
x0=0;
y0=0;
z0=0;
tolerancia=10^-3;
x_nuevo=double(subs(subs(fx,y0),z0));
y_nuevo=double(subs(subs(fy,x0),z0));
z_nuevo=double(subs(subs(fz,x0),y0));
eax=100;
eay=100;
eaz=100;
Di=max([eax,eay,eaz]);
i=0;
fprintf('i x0 y0 z0 Eax Eay Eaz Di \n');
while(Di>tolerancia)
fprintf('%d %d %d %d %d %d %d %d \n', i,x0,y0,z0,eax,eay,eaz,Di);
x_nuevo=double(subs(subs(fx,y0),z0));
y_nuevo=double(subs(subs(fy,x0),z0));
z_nuevo=double(subs(subs(fz,x0),y0));
eax=abs(x_nuevo-x0);
eay=abs(y_nuevo-y0);
eaz=abs(z_nuevo-z0);
Di=max([eax,eay,eaz]);
x0=x_nuevo;
y0=y_nuevo;
z0=z_nuevo;
i=i+1;
end
fy =
fz =
x =
957/56
y =
-6105/251
48
z =
5163/671
fz=(76-3*x-7*y)/13;
fx=(1-3*y+5*z)/2;
fy=(28-x-3*z)/5;
x_ant=0;
y_ant=0;
z_ant=double(subs(fz, [x,y], [x_ant,y_ant]));
z_nuevo=z_ant;
x_nuevo=x_ant;
y_nuevo=y_ant;
tolerancia=10^-5;
eax=100;
eay=100;
eaz=100;
Di=max([eax,eay,eaz]);
i=0;
fprintf('i, x_ant, y_ant, z_ant, eax, eay, eaz, Di \n');
49
while(Di>tolerancia)
x_nuevo = double(subs(fx, [y,z], [y_nuevo,z_nuevo]));
y_nuevo = double(subs(fy, [x,z], [x_nuevo,z_nuevo]));
z_nuevo = double(subs(fz, [x,y], [x_nuevo, y_nuevo]));
eax=abs(x_nuevo-x_ant);
eay=abs(y_nuevo-y_ant);
eaz=abs(z_nuevo-z_ant);
Di=max([eax,eay,eaz]);
x_ant=x_nuevo;
y_ant=y_nuevo;
z_ant=z_nuevo;
i=i+1;
fprintf('%d %d %d %d %d %d %d %d \n',...
i,x_ant,y_ant,z_ant,eax,eay,eaz,Di);
end
x_nuevo
y_nuevo
z_nuevo
prueba:
A =
2 3 -5
1 5 3
3 7 13
A1 =
A2 =
2 3
1 5
A3 =
2 3 -5
1 5 3
3 7 13
Es definida positiva.
50
i, x_ant, y_ant, z_ant, eax, eay, eaz, Di
1 1.511538e+01 -9.307692e-01 2.859172e+00 1.511538e+01 9.307692e-01 2.986982e+00
1.511538e+01
2 9.044083e+00 2.075680e+00 2.641384e+00 6.071302e+00 3.006450e+00 2.177879e-01
6.071302e+00
3 3.989939e+00 3.217182e+00 3.193070e+00 5.054144e+00 1.141502e+00 5.516863e-01
5.054144e+00
51
x_nuevo =
4.7931
y_nuevo =
2.6552
z_nuevo =
3.3103
4 a+2 b+ c=1
2 a+2 b=2
a+3 c =3
Script:
format rat
clc
A=[4 2 1; 2 2 0; 1 0 3]
A1=[4]
A2=[4 2; 2 2]
A3=A
det1=det(A1)
det2=det(A2)
det3=det(A3)
if(A==A')
disp('Es simetrica.');
else
disp('No es simetrica.');
end
L11=sqrt(A(1,1))
L21=A(2,1)/L11
L22=sqrt(A(2,2)-(L21^2))
52
L31=A(3,1)/L11
L32=(A(3,2)-L21*L31)/L22
L33=sqrt(A(3,3)-(L31^2)-(L32^2))
L=[L11 0 0; L21 L22 0; L31 L32 L33]
U=L'
R=L*U
b=[1 2 3]
b=b'
y=L\b
x=U\y
for i=1:length(x)
fprintf('Los valores de x%i=%d \n',i,x(i) );
end
prueba:
A =
4 2 1
2 2 0
1 0 3
A1 =
A2 =
4 2
2 2
A3 =
4 2 1
2 2 0
1 0 3
det1 =
det2 =
53
4
det3 =
10
Es simetrica.
Es definida positiva.
L11 =
L21 =
L22 =
L31 =
1/2
L32 =
-1/2
L33 =
721/456
L =
2 0 0
1 1 0
54
1/2 -1/2 721/456
U =
2 1 1/2
0 1 -1/2
0 0 721/456
R =
4 2 1
2 2 0
1 0 3
b =
1 2 3
b =
1
2
3
y =
1/2
3/2
228/103
x =
-6/5
11/5
7/5
55
Los valores de x2=2.200000e+00
Los valores de x3=1.400000e+00
56