Post Reply 
Automatic differentiation using dual numbers
06-20-2022, 05:31 PM
Post: #16
The strange cousin of the complex numbers -- the dual numbers
Just stumbled upon this video by Michael Penn:

The strange cousin of the complex numbers -- the dual numbers

We can follow the lecture with our HP-42S.

1:39:

\(
\begin{align}
(2 + 3 \varepsilon)(5 - \varepsilon) = 10 + 13 \varepsilon
\end{align}
\)

2 ENTER 3 COMPLEX
5 ENTER -1 COMPLEX
XEQ "*"

10 i13

7:07:

\(
\begin{align}
\frac{3 + 2 \varepsilon}{2 + 5 \varepsilon} = \frac{3}{2} - \frac{11}{4} \varepsilon
\end{align}
\)

3 ENTER 2 COMPLEX
2 ENTER 5 COMPLEX
XEQ "/"

1.5 -i2.75

We can also use the matrix representation instead of using complex numbers:

2 3
0 2

5 -1
0 5

*

10 13
0 10


3 2
0 3

2 5
0 2

/

1.5 -2.75
0 1.5

The advantage is that we now get "*", "/" and "1/X" for free.
We'd probably write a constructor (similar to COMPLEX) that simplifies entering values.
And then another function to display them.

Unfortunately function application on a matrix is implemented element-wise.
Otherwise we could simply use the ordinary functions like EXP or SIN on these dual numbers.
Thus we still have to implement that by ourselves.

Hint: If you want to copy and paste the matrices into Free42, quote this post and do it from the input form.
The separator has to be a tabulator character which is transmogrified into a space character by the software of this forum.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Fixed Point Iteration - Thomas Klemm - 06-19-2022, 08:31 PM
The strange cousin of the complex numbers -- the dual numbers - Thomas Klemm - 06-20-2022 05:31 PM



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