Use a Python function, either using def
, or using lambda
.
This will let you evaluate the function, and plot it.
Here, using lambda
:
sage: W = RealDistribution('lognormal',[1.5, .6])
sage: def N(x): return W.cum_distribution_function(x)
sage: N(4)
0.4248467949573992
sage: plot(N, (x, 0, 10))
Here, using def
:
sage: W = RealDistribution('lognormal',[1.5, .6])
sage: N = lambda x: W.cum_distribution_function(x)
sage: N(4)
0.4248467949573992
sage: plot(N, (x, 0, 10))
The down side is you need to do that for every variation based on N.
For instance, to plot 1 - N
,
sage: NN = lambda x: 1 - N(x)
sage: plot (NN, (x, 0, 10))
Of course, to eg differentiate it, you would really need a symbolic function.
Maybe someone knows how to turn it into a symbolic function.
Maybe it's worth opening a Sage trac ticket to make cumulative distribution functions symbolic.
See https://trac.sagemath.org/wiki/symbolics/functions.