Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Represent a dual number
ResourceFunction["DualNumber"][a,b] returns the dual number a+bε. |
Get the dual number 1+2ε:
In[1]:= | ![]() |
Out[1]= | ![]() |
Add two dual numbers:
In[2]:= | ![]() |
Out[2]= | ![]() |
Multiply two dual numbers:
In[3]:= | ![]() |
Out[3]= | ![]() |
A procedurally-defined function:
In[4]:= | ![]() |
Evaluate at a dual number argument with unit dual part:
In[5]:= | ![]() |
Out[5]= | ![]() |
The real part is equal to the function evaluated at the real part of the argument:
In[6]:= | ![]() |
Out[6]= | ![]() |
The dual part is equal to the derivative of the function:
In[7]:= | ![]() |
Out[7]= | ![]() |
Compare with a central difference approximation:
In[8]:= | ![]() |
Out[8]= | ![]() |
In the conjugate of a dual number, the sign of the dual part is reversed:
In[9]:= | ![]() |
Out[9]= | ![]() |
Use Re and the resource function DualPart to extract the real and dual parts of a dual number:
In[10]:= | ![]() |
Out[10]= | ![]() |
The sign of a dual number is defined to be the sign of its real part:
In[11]:= | ![]() |
Out[11]= | ![]() |
The absolute value of a dual number is the absolute value of its real part:
In[12]:= | ![]() |
Out[12]= | ![]() |
Dual numbers have the following "polar form":
In[13]:= | ![]() |
Out[13]= | ![]() |
Use Norm to get the standard Euclidean length of a dual number:
In[14]:= | ![]() |
Out[14]= | ![]() |
Evaluate the exponential of a dual number:
In[15]:= | ![]() |
Out[15]= | ![]() |
Raise a dual number to a dual number power:
In[16]:= | ![]() |
Out[16]= | ![]() |
Just as with complex numbers, Mod works on dual numbers:
In[17]:= | ![]() |
Out[17]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License