Implementarea c atorva metode numerice n Mathematica [616668]
Implementarea c^ atorva metode numerice ^ n Mathematica
Facultatea de S tiint e
Matematic a-Informatic a
Student: [anonimizat] stiint ic :
R aducu-R azvan Gheorghe
Anul III Conf. Dr. Florin Sofonea
Sibiu
2017
Facultatea de S tiint e Matematic a-Informatic a Student: [anonimizat] stiint ic :
R aducu-R azvan Gheorghe
Anul III Conf. Dr. Florin SofoneaSibiu 2017 Implementarea c^ atorva metode numerice ^ n Mathematica 1 / 20
1Metoda Newton
2Metoda lui Romberg aplicat a metodei Newton
3Implementarea geometric a ^ n Mathematica
4Bibliograe
Facultatea de S tiint e Matematic a-Informatic a Student: [anonimizat] stiint ic :
R aducu-R azvan Gheorghe
Anul III Conf. Dr. Florin SofoneaSibiu 2017 Implementarea c^ atorva metode numerice ^ n Mathematica 2 / 20
Metoda Newton
Fief: [a;b]!R si e x02[a;b]. Dezvolt am funct ia f ^ n serie Taylor
si ret inem primii doi termeni. Obt inem
f(x)f(x0) + (x x0)f0(x0):
^Inlocuim ecuat ia f(x) = 0 cu
(1) f(x0) + (x x0)f0(x0) = 0
a c arei solut ie este
x1=x0 f(x0)
f0(x0):
Facultatea de S tiint e Matematic a-Informatic a Student: [anonimizat] stiint ic :
R aducu-R azvan Gheorghe
Anul III Conf. Dr. Florin SofoneaSibiu 2017 Implementarea c^ atorva metode numerice ^ n Mathematica 3 / 20
Prin ^ nlocuirea lui x0cuxk, respectiv x1cuxk+1, se obt ine metoda lui
Newton sau metoda Newton-Raphson
(2) xk+1=x0 f(xk)
f0(xk):
Ecuat ia f(x0) + ( x x0)f0(x0) = 0 aproximeaz a ecuat ia f(x) = 0 ^ n
vecin atatea punctului x0.
Facultatea de S tiint e Matematic a-Informatic a Student: [anonimizat] stiint ic :
R aducu-R azvan Gheorghe
Anul III Conf. Dr. Florin SofoneaSibiu 2017 Implementarea c^ atorva metode numerice ^ n Mathematica 4 / 20
Pentru a verica dac a x1aproximeaz a solut ia acestei ecuat ii este necesar a
analiza existent ei sirului xk.^In cazul ^ n care se face ipoteza f0(x) = 0 pe
intervalul [ a;b] acest lucru nu mai este necesar.
Dac a ^ n (2) se ^ nlocuie ste f0(xk) cu f0(x0) rezult a metoda lui Newton
simplicat a,
xk+1=x0 f(xk)
f0(x0);
^ n care derivata se calculeaz a doar ^ n punctul x0.
Facultatea de S tiint e Matematic a-Informatic a Student: [anonimizat] stiint ic :
R aducu-R azvan Gheorghe
Anul III Conf. Dr. Florin SofoneaSibiu 2017 Implementarea c^ atorva metode numerice ^ n Mathematica 5 / 20
Putem considera un proces de tip Newton ^ n care calculul derivatei se face
dup a un anumit num ar de pa si:
xk+1=x0 f(xk)
f0(xp(k));
unde p(k) este un num ar ^ ntreg mai mic sau egal cu k. Dac a consider am
p(k)=0 obt inem metoda lui Newton simplicat a.
Facultatea de S tiint e Matematic a-Informatic a Student: [anonimizat] stiint ic :
R aducu-R azvan Gheorghe
Anul III Conf. Dr. Florin SofoneaSibiu 2017 Implementarea c^ atorva metode numerice ^ n Mathematica 6 / 20
Unul din procesele de tip iterativ, ce genereaz a metoda lui Newton
simplicat a, este metoda liniilor paralele:
xk+1=xk f(xk);
undeeste o constant a care aproximeaz a1
f0(x0):
Metoda lui Newton discretizat a este metoda ^ n care derivata este ^ nlocuit a
cu diferent a divizat a de ordinul ^ nt^ ai:
xk+1=xk f(xk) f(xk 1)
xk xk 1 1
f(xk):
Aceast a metod a coincide cu metoda secantei.
Facultatea de S tiint e Matematic a-Informatic a Student: [anonimizat] stiint ic :
R aducu-R azvan Gheorghe
Anul III Conf. Dr. Florin SofoneaSibiu 2017 Implementarea c^ atorva metode numerice ^ n Mathematica 7 / 20
Metoda lui Romberg
C aut am o formul a de aproximare pentrup
A, astfel ^ nc^ at s a aib a
ordinul trei de convergent a. Pentru aceasta plec am de la urm atoarea
ecuat ie
f(x) =xd(x2 A) = 0 ;x>0;A>0:
S tim c a funct ia de iterat ie
'(x) =x f(x)
f0(x);
are ordinul mai mare sau egal cu doi.
Facultatea de S tiint e Matematic a-Informatic a Student: Coordonator stiint ic :
R aducu-R azvan Gheorghe
Anul III Conf. Dr. Florin SofoneaSibiu 2017 Implementarea c^ atorva metode numerice ^ n Mathematica 8 / 20
Ne propunem s a-l g asim pe d astfel ^ nc^ at
xn+1='(xn)
s a aib a ordinul de convergent a trei. Calcul am derivatele funct iei f p^ an a la
ordinul doi.
f(x) =x(2+d) Axd;
f0(x) = (2 + d)x1+d dAxd 1;
f00(x) = (2 + d)(1 + d)xd d(d 1)Axd 1;
Facultatea de S tiint e Matematic a-Informatic a Student: Coordonator stiint ic :
R aducu-R azvan Gheorghe
Anul III Conf. Dr. Florin SofoneaSibiu 2017 Implementarea c^ atorva metode numerice ^ n Mathematica 9 / 20
Punem condit iile
'(p
A) =p
A; '0(p
A) = 0; '00(p
A) = 0;:::;
(3)'(x) =x (x2 A)xd
xd 1[(2 + d)x2 dA]=x xx2 A
(2 + d)x2 dA:
Facultatea de S tiint e Matematic a-Informatic a Student: Coordonator stiint ic :
R aducu-R azvan Gheorghe
Anul III Conf. Dr. Florin SofoneaSibiu 2017 Implementarea c^ atorva metode numerice ^ n Mathematica 10 / 20
Obt inem
'0= 1 f02 00
f02=ff00
f02; '0(p
A) = 0
'00=f00
f0+ff00
f020
:
Facultatea de S tiint e Matematic a-Informatic a Student: Coordonator stiint ic :
R aducu-R azvan Gheorghe
Anul III Conf. Dr. Florin SofoneaSibiu 2017 Implementarea c^ atorva metode numerice ^ n Mathematica 11 / 20
Pun^ and condit ia '00(p
A) = 0;g asim
f00(p
A) = 0;
deci
(2 + d)(1 + d) d(d 1) = 0;
de unde rezult a d= 1
2:^Inlocuind valoarea lui d ^ n relat ia (3) obt inem
'(x) =x xx2 A
3
2×2+1
2A;
deci g asim funct ia iterativ a
'(x) =xx2+ 3A
3×2+A;
cu ordinul trei de convergent a.
Facultatea de S tiint e Matematic a-Informatic a Student: Coordonator stiint ic :
R aducu-R azvan Gheorghe
Anul III Conf. Dr. Florin SofoneaSibiu 2017 Implementarea c^ atorva metode numerice ^ n Mathematica 12 / 20
S irul ( xn)n0, cu xn+1='(xn);x0=A+1
2constituie metoda lui Romberg,
pentru determinarea r ad acinii p atrate.
Deci, ^ n loc s a rezolv am cu metoda tangentei ecuat ia x2 A= 0;este mai
avantajos s a aplic am metoda tangentei ecuat iei echivalente
1px(x2 A) = 0;x>0:
Facultatea de S tiint e Matematic a-Informatic a Student: Coordonator stiint ic :
R aducu-R azvan Gheorghe
Anul III Conf. Dr. Florin SofoneaSibiu 2017 Implementarea c^ atorva metode numerice ^ n Mathematica 13 / 20
Implementarea ^ n Mathematica
basicstyle basicstyle basicstyle
basicstyle basicstyle basicstyle M a n i p u l a t e [
basicstyle basicstyle basicstyle NewtonPlot [ G e t F u n c t i o n [ f u n c t i o n ] ,
basicstyle basicstyle basicstyle RangeToVary [ GetRange [ f u n c t i o n ] , x0 ] , 10^( 2) , GetRange [ f u n c t i o n ] ,
basicstyle basicstyle basicstyle zoom , 2 0 ] ,
basicstyle basicstyle basicstyle fff u n c t i o n , f u n c t i o n r u l e s [ [ 1 , 1 ] ] g,
basicstyle basicstyle basicstyle Dynamic [ F i r s t /@ f u n c t i o n r u l e s , SynchronousUpdating >False ] ,
basicstyle basicstyle basicstyle ControlType >PopupMenug,
basicstyle basicstyle basicstyle ffx0 , 0 , " s t a r t i n g p o i n t "g, 0 , 1g,
basicstyle basicstyle basicstyle ffzoom , 0 . 9g, 0 . 1 , . 9g,
basicstyle basicstyle basicstyle TrackedSymbols : >ff u n c t i o n , x0 , zoom g,
basicstyle basicstyle basicstyle S y n c h r o n o u s I n i t i a l i z a t i o n >False ,
basicstyle basicstyle basicstyle AutorunSequencing >f2 , 3g,
Facultatea de S tiint e Matematic a-Informatic a Student: Coordonator stiint ic :
R aducu-R azvan Gheorghe
Anul III Conf. Dr. Florin SofoneaSibiu 2017 Implementarea c^ atorva metode numerice ^ n Mathematica 14 / 20
basicstyle basicstyle basicstyle
basicstyle basicstyle basicstyle I n i t i a l i z a t i o n : >(
basicstyle basicstyle basicstyle NewtonsMethod [ f , x , n z : 10^( 10)] :=
basicstyle basicstyle basicstyle I f[Abs [ f x ] ]>nz , N[ x f [ x ] / f x ] ] , NewtonError ] ;
basicstyle basicstyle basicstyle ConvergenceTest [ f , x ,
basicstyle basicstyle basicstyle t o l ] := ( Abs [ x ]>t o l && x =!= NewtonError ) ;
basicstyle basicstyle basicstyle FindRootNewton [ f , x0 , t o l , m a x i t e r : 1 0 0 ] :=
basicstyle basicstyle basicstyle NestWhileList [ NewtonsMethod [ f , #] &, x0 ,
basicstyle basicstyle basicstyle ConvergenceTest [ f , #, t o l ] &, 1 , m a x i t e r ] ;
basicstyle basicstyle basicstyle p o i n t S t y l e [ s i z e , c o l o r , p t ] :=fPointSize [ s i z e ] , c o l o r ,
basicstyle basicstyle basicstyle Point [ pt ]g;
basicstyle basicstyle basicstyle s t d o p t s = Sequence [ImageSize >f250 , 150g,PlotStyle >Black ] ;
basicstyle basicstyle basicstyle NewtonPlot [ f , x0 , t o l ,fxmin , xmaxg, zoom , max ] :=
basicstyle basicstyle basicstyle Module [fi t e r a t e s =
basicstyle basicstyle basicstyle FindRootNewton [ f , x0 , t o l , max ] , fmtpts , f m t l i n e s , fmtarrows ,
basicstyle basicstyle basicstyle ip , fp , l pg,
basicstyle basicstyle basicstyle l p = Last [ i t e r a t e s ] ;
Facultatea de S tiint e Matematic a-Informatic a Student: Coordonator stiint ic :
R aducu-R azvan Gheorghe
Anul III Conf. Dr. Florin SofoneaSibiu 2017 Implementarea c^ atorva metode numerice ^ n Mathematica 15 / 20
basicstyle basicstyle basicstyle
basicstyle basicstyle basicstyle I f[ l p =!= NewtonError ,
basicstyle basicstyle basicstyle f p = p o i n t S t y l e [ Large , Red ,f#, f [#]g&@Last [ i t e r a t e s ] ] ;
basicstyle basicstyle basicstyle i p = p o i n t S t y l e [ Large , Green ,f#, f [ # ]g] &@ F i r s t [ i t e r a t e s ] ;
basicstyle basicstyle basicstyle f m t p t s = p o i n t S t y l e [ Medium , Blue ,f#, f [ # ]g] & /@ i t e r a t e s ;
basicstyle basicstyle basicstyle f m t l i n e s =f fBlue ,
basicstyle basicstyle basicstyle Line [ffF i r s t [#] , f [ F i r s t [ # ] ]g,fLast [#] , 0gg]g,fOrange ,
basicstyle basicstyle basicstyle Line [ffLast [#] , 0g,fLast [#] , f [ Last [ # ] ]gg]gg & /@
basicstyle basicstyle basicstyle Reverse [Partition [ i t e r a t e s , 2 , 1 ] ] ;
basicstyle basicstyle basicstyle Grid [ffPlot [ f [ x ] ,fx , xmin , xmax g,
basicstyle basicstyle basicstyle Epilog >ff m t l i n e s , fmtpts , ip , f p g,Evaluate [ s t d o p t s ] ] ,
basicstyle basicstyle basicstyle Plot [ f [ x ] ,fx , l p zoom , l p + zoom g,
basicstyle basicstyle basicstyle Epilog >ff m t l i n e s , fmtpts , ip , f p g,Evaluate [ s t d o p t s ] ]g,
basicstyle basicstyle basicstyle fPlot [ f [ x ] ,fx , l p zoom ^2 , l p + zoom ^2 g,
basicstyle basicstyle basicstyle Epilog >ff m t l i n e s , fmtpts , ip , f p g,Evaluate [ s t d o p t s ] ] ,
basicstyle basicstyle basicstyle Plot [ f [ x ] ,fx , l p zoom ^3 , l p + zoom ^3 g,
basicstyle basicstyle basicstyle Epilog >ff m t l i n e s , fmtpts , ip , f p g,Evaluate [ s t d o p t s ] ]gg ] ,
basicstyle basicstyle basicstyle "Newton E r r o r D i v i d e by Zero " ]
basicstyle basicstyle basicstyle ] ;
Facultatea de S tiint e Matematic a-Informatic a Student: Coordonator stiint ic :
R aducu-R azvan Gheorghe
Anul III Conf. Dr. Florin SofoneaSibiu 2017 Implementarea c^ atorva metode numerice ^ n Mathematica 16 / 20
basicstyle basicstyle basicstyle f u n c t i o n s =f
basicstyle basicstyle basicstyle fFunction [ x , x ^2 Pi] ,f 2, 2g, 0g,
basicstyle basicstyle basicstyle fFunction [ x , (1/ x ^ ( 1 / 2 ) ) ( x ^2 Pi) ] ,f 2, 2g, 0g,
basicstyle basicstyle basicstyle g;
basicstyle basicstyle basicstyle
basicstyle basicstyle basicstyle f u n c t i o n r u l e s =
basicstyle basicstyle basicstyle ToString [Last [F i r s t [ # ] ] , TraditionalForm ] ># & /@ f u n c t i o n s ;
basicstyle basicstyle basicstyle G e t F u n c t i o n [ s t r ] := F i r s t [ s t r / . f u n c t i o n r u l e s ] ;
basicstyle basicstyle basicstyle GetRange [ s t r ] := Part [ s t r / . f u n c t i o n r u l e s , 2 ] ;
basicstyle basicstyle basicstyle RangeToVary [fa, bg, x ] := a + x ( b a ) ;
basicstyle basicstyle basicstyle ) ]
Facultatea de S tiint e Matematic a-Informatic a Student: Coordonator stiint ic :
R aducu-R azvan Gheorghe
Anul III Conf. Dr. Florin SofoneaSibiu 2017 Implementarea c^ atorva metode numerice ^ n Mathematica 17 / 20
Interpretarea geometric a a metodei Newton pentru calculul luip
Facultatea de S tiint e Matematic a-Informatic a Student: Coordonator stiint ic :
R aducu-R azvan Gheorghe
Anul III Conf. Dr. Florin SofoneaSibiu 2017 Implementarea c^ atorva metode numerice ^ n Mathematica 18 / 20
Interpretarea geometric a a metodei Romberg pentru calculul luip
Facultatea de S tiint e Matematic a-Informatic a Student: Coordonator stiint ic :
R aducu-R azvan Gheorghe
Anul III Conf. Dr. Florin SofoneaSibiu 2017 Implementarea c^ atorva metode numerice ^ n Mathematica 19 / 20
Daniel Florin Sofonea , Analiz a Numeric a si Teoria Aproxim arii,
Editura universit at ii din Bucure sti, 2006
Vraciu George, Micu Sorin, Efrem Raluca, C alug aru Dan, Analiz a
numeric a-Metode numerice ^ n algebr a si ^ n metoda elementelor nite-
Culegere de exercit ii si probleme- volumul al II-lea, Reprograa
Universit at ii din Craiova, 1999
Alexandru Lupa s, Analiz a Numeric a, Editura ULBS, 1997
P. Blaga Analiz a Numeric a si Teoria Aproxim arii, Cluj, 2010
Facultatea de S tiint e Matematic a-Informatic a Student: Coordonator stiint ic :
R aducu-R azvan Gheorghe
Anul III Conf. Dr. Florin SofoneaSibiu 2017 Implementarea c^ atorva metode numerice ^ n Mathematica 20 / 20
Copyright Notice
© Licențiada.org respectă drepturile de proprietate intelectuală și așteaptă ca toți utilizatorii să facă același lucru. Dacă consideri că un conținut de pe site încalcă drepturile tale de autor, te rugăm să trimiți o notificare DMCA.
Acest articol: Implementarea c atorva metode numerice n Mathematica [616668] (ID: 616668)
Dacă considerați că acest conținut vă încalcă drepturile de autor, vă rugăm să depuneți o cerere pe pagina noastră Copyright Takedown.
