RE: Using the Normal Distribution in Maxima



hello tolga,

> Can I do the following:
> 
> - define a function myself, just simply called N(x)
> - tell Maxima that dN=n, i.e. that if it encounters N during differentiation,
> it should just return n
> - and then differentiate as below
> 
> Maxima doesn't have to know what N is (i.e. for example that
> N(x)=1/2 erf(x/sqrt(2)) .

you can use the gradef function to define the derivative of N ...

(%i1) gradef (N(x), dN(x));
(%o1) N(x)
(%i2) diff (N(f(x)), x);
(%o2) dN(f(x))*'diff(f(x),x,1)

it is not necessary to define N before using it in an expression.

if at some later stage you want to substitute the definition of dN,
you could do dN (x) := exp (-x^2/2)/sqrt(2 * %pi);  ''%o2;
(note the presence of two single quote marks '' in front of %o2 --
that means to re-evaluate %o2.)

hope this helps,
robert dodier