Automatic differentiation using dual numbers
|
06-20-2022, 09:50 PM
Post: #17
|
|||
|
|||
RE: Automatic differentiation using dual numbers
Perhaps it is better to think of dual number as a container, holding symbolic variables.
That's why even with complicated expressions, derivative only has slight rounding errors, due to symbolic variables really stored numerically. This is why variable as {x, 1}: f(x) = x → f'(x) = 1 Plain constant simply {c, 0}: f(x) = c → f'(x) = 0 (06-20-2022 05:31 PM)Thomas Klemm Wrote: \( Think of this as getting {f*g, (f*g)'}, forget about ε (f*g) = 2*5 = 10 (f*g)' = f'*g + f*g' = 3*5 + 2*-1 = 13 Again, do not think of them as numbers; think of them as symbolic, stored numerically. --- If we wanted to extend container to hold more derivatives, ε is a bad idea. Example, we want to carry 2 derivatives, instead of 1. CAS> expand((1+2*ε+3*ε^2) * (3+ε+4*ε^2)) 3 + 7*ε + 15*ε^2 + 11*ε^3 + 12*ε^4 Do this symbolically (recommended), we get correct answer. {f, f', f''} = {1,2,3} {g,g',g''} = {3,1,4} (f*g) = 1*3 = 3 (f*g)' = f'*g + f*g' = 2*3 + 1*1 = 7 (f*g)'' = f''*g + f'*g' + f'*g' + f*g'' = 3*3 + 2*(2*1) + 1*4 = 17 |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)