Dual Number and Bidual Number
Let $a$ and $b$ be real numbers, the dual number is an expression in the form $a+b\varepsilon$, where $\varepsilon$ is a symbol taken to satisfy $\varepsilon^2 =0$ with $\varepsilon\ne 0$.
Dual numbers can be added or subtracted component-wise, $(a+b\varepsilon)\pm(c+d\varepsilon)=(a\pm c)+(b\pm d)\varepsilon$. They are multiplied by the formula $(a+b\varepsilon)(c+d\varepsilon)=ac+(bc+ad)\varepsilon$. We do dual number division as below \[ \frac{a+b\varepsilon}{c+d\varepsilon} = \frac{a+b\varepsilon}{c+d\varepsilon}\times \frac{c-d\varepsilon}{c-d\varepsilon} = \frac{ac+(bc-ad)\varepsilon}{c^2},\quad c\ne 0 \]
If $f(x)$ is a differentiable function of real numbers $x$, using Taylor expansion we get \[ f(a+b\varepsilon) = f(a) + f'(a)b\varepsilon + \left\{f''(a)\frac{b^2}{2!}+\cdots\right\}\varepsilon^2 \] As $\varepsilon^2=0$, we have a function of a dual number $f(a+b\varepsilon)=f(a)+f'(a)b\varepsilon$. With this property, dual numbers can be used in automatic differentiation to find the derivative of a function.
Similar to the dual number, the bidual number is an expression in the form $(a+b\varepsilon_1)+(c+d\varepsilon_1)\varepsilon_2$ or $a+b\varepsilon_1+c\varepsilon_2+d\varepsilon_1\varepsilon_2$ where $\varepsilon_1^2=\varepsilon_2^2=0$ with $\varepsilon_1\ne 0$, $\varepsilon_2\ne 0$, and $\varepsilon_1\varepsilon_2\ne 0$. The mathematical operations applied to the dual number above can also be applied to the bidual number. This calculator supports both of them.
Input Data
As an example, let us see how to use this calculator to calculate \[2(3-2\varepsilon)+8+4\varepsilon+\exp(2-\varepsilon)\sin\left\{(3-2\varepsilon)(8+4\varepsilon)\right\}-10\] Firstly, we define three variables $x_1=3-2\varepsilon$, $x_2=8+4\varepsilon$, and $x_3=2-\varepsilon$, then enter these data as $3\times 2$ matrix with $i^{\text{th}}$ row is the value of $x_i$. So we have the following input for three dual numbers:
3 -2 8 4 2 -1Now we enter the math expression we want to calculate
2*x1+x2+exp(x3)*sin(x1*x2)-10Note that this calculator uses a math expression/function in the same format as used in Gradient Calculator or Hessian Calculator. All mathematical functions and constants listed in Derivative Calculator are supported by this calculator.
In the case of bidual numbers, enter their data as $n\times 4$ matrix, where $n$ is the number of bidual numbers. For example, we want to calculate \[ \left( \frac{\pi}{4}+\varepsilon_1+\varepsilon_2\right)^2\sin\left( \frac{\pi}{4}+\varepsilon_1+\varepsilon_2\right) \] enter the followings:
pi/4 1 1 0as the value of the bidual number and
x1^2*sin(x1)as the math expression.