exp

Exponential function on dual numbers.

exp
@safe pure nothrow @nogc
(
T
)
()

Return Value

Type: Dual!T

exp(x)

Examples

1 import std.math;
2 // f(x) = exp(x), f'(x) = exp(x)
3 auto x = dual(5.0, 1.0);
4 auto res = x.exp();
5 assert(approxEqual(res.re, std.math.exp(5.0)));
6 assert(approxEqual(res.du, std.math.exp(5.0)));
7 
8 // f(x) = exp(3x), f'(x) = 3*exp(3x)
9 res = exp(3 * x);
10 assert(approxEqual(res.re, std.math.exp(15.0)));
11 assert(approxEqual(res.du, 3 * std.math.exp(15.0)));

Meta