Dual Numbers and Differentiation. Part 3.

Previously we looked at using Dual numbers get the value of the first derivative of a function. As useful as this is there is more potential if we can also obtain the second derivative. My initial, naive, approach to this was to extend the idea of a Dual to that of a Triple like this. data Triple a = T a a a deriving (Show). Creating Triple somehow seemed ‘wrong’, or if not wrong then certainly clumsy as can be seen in some of the code below.

Note how messy the code is! It’s the result of apply the quotient rule to the result of applying the quotient Read More

Dual Numbers and Differentiation. Part 2.

At the end of the previous post I had intended this posting to be an exploration of a recursive definition of Dual that will give an infinite (lazy) list of derivatives. However, there’s still a lot to play with using our simple data Dual a = Dual a a Let’s try a simple function of two variables…     and at we have     Now we can evaluate at using dual numbers with a subscript of x or y to ‘remember’ where it came from…i.e we want but really are the ‘same thing’.     Notice that the coefficients of are the same as the Read More

Dual Numbers and Differentiation. Part 1.

Overview Just recently I came across the interesting and, at first viewing, the rather abstract idea of dual numbers. I suppose they are no more or less abstract than other numbers… anyway the idea is similar to that of complex numbers where we have     Dual numbers are quite similar, we have the dual number d as     So now lets take this idea of a dual number and explore how adding, multiplying and dividing them might be defined. Addition and subtraction are simple – we just add the corresponding components – in much the same way that Read More

ˆ Back To Top