Post Reply 
Automatic differentiation using dual numbers
06-19-2022, 11:25 AM
Post: #12
RE: Automatic differentiation using dual numbers
More Examples

From an older thread:
Find the minimum of \(\sqrt[3]{x}(x+4)\).

Code:
11▸LBL "f(x)"
12 RCL "x"
13 3
14 XEQ "NROOT"
15 RCL "x"
16 4
17 +
18 XEQ "*"
19 END

SOLVER

Select Solve Program
f'(x)

-4 x
x=-4

0 x
x=0

x
-1

-1 from Solve[D[Surd[x,3](x+4),x]=0]



From message #52 of hp 35s not very impressive:
Numerically find a root of \(\sin(\cos(x)+x)=1\) for \(x \in [0, \pi]\).

Code:
11▸LBL "f(x)"
12 RCL "x"
13 XEQ "COS"
14 RCL+ "x"
15 XEQ "SIN"
16 1
17 -
18 END


1 XEQ "NEWTON" R/S R/S R/S …

1.096185496720379254068448344585068
1.175888114785594876983050355722717
1.242050787237047966508965780229636
1.297040015847465356429262431517609
1.342780395438986475883038203450154
1.380849045692581522517271141667455
1.412545052274972359330312135368247
1.438942302919224509400448646856456
1.460930716999602583570957867391215
1.479249022592746437337540456509254
1.494511170421290703644758554012951
1.507227829978447782058849865750785
1.517824006751892972090594565180035
1.526653552641516102517803677349702
1.534011159566718715000530836754409
1.540142297317008509515873034239361
1.54525146226124394188595647414023
1.549509032291505688761007830343301
1.553056968300240276217842622504177
1.556013559062516129214210739762696
1.558477371631839185818134801079616
1.560530541211757536883595443592954
1.562241511486046176440960584008961
1.563667317515769249502272196990959
1.564855487741827589822012469653988
1.5658456287488595130191653943798
1.566670745763970142235788700312658
1.567358342992564331745470195675238
1.567931340518708971144634527031736
1.568408838362052654583316328637151
1.568806753176465137666022447896715
1.569138348823290027153250798000587
1.569414678510544465261158813819254
1.569644953239255937574657672473129
1.569836848840342335174954121320105
1.569996761837675236006348072590862
1.570130022666718605870849598706333
1.570241073356391686024755750742321
1.570333615597093564376103876143107
1.570410734130611068186649461486481
1.570474999574977213095175517708114
1.570528554111814785112668043102819
1.570573182892434548623033555727806
1.570610373542906751998078209406487
1.57064136575160961719034182259993
1.570667192592178057949124917149796
1.570688714959325685163863462493728
1.570706650265258827155523702630545
1.570721596353569424513573787698215
1.570734051427489393921579858910183
1.570744430654950406742411512076897
1.570753080010948337990727107957772
1.570760287808507356277721295289301
1.570766294312730998804956970621129
1.570771299748680808303996882049845
1.570775470908511415841082922756551
1.57077894663999092675862234031804
1.5707818432162089638123982822793
1.570784256952696171292749185689969
1.570786266649663336458847535382422
1.570787943608822423042808769861741
1.57078933476841216946339413363803
1.570790483678136851887361443677913
1.570791540762559672731902800264383
1.57079249648789454488183911785543
1.57079249648789454488183911785543
1.57079249648789454488183911785543

1.57079632679489661923132169163975144209...

The exact root is \(\frac{\pi}{2}\).

We notice the slow convergence since the function is very flat at the root.
Obviously we stop getting closer once \(f(x)=0\).



From Max of (sin(x))^(e^x):
Find the maximum of \(\sin(x)^{e^x}\) between \(13\) and \(15\).

Code:
11▸LBL "f(x)"
12 RCL "x"
13 XEQ "SIN"
14 XEQ "LN"
15 RCL "x"
16 XEQ "E↑X"
17 XEQ "*"
18 XEQ "E↑X"
19 END

SOLVER

Select Solve Program
f'(x)

14.13 x
x=14.13

14.14 x
x=14.14

x
14.13716694115406957308189522475776

14.1371669411540695730818952247577629788...

The exact solution is \(\frac{9\pi}{2}\).
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Automatic differentiation using dual numbers - Thomas Klemm - 06-19-2022 11:25 AM
Fixed Point Iteration - Thomas Klemm - 06-19-2022, 08:31 PM



User(s) browsing this thread: 5 Guest(s)