I have this (very naïvely defined) Python function :
def dunif(x,a,b):
if(x<a):return(0)
elif(x>b):return(0)
else:return(1/(b-a))
I can plot that easily
plot(lambda x:dunif(x,-1,1), (x,-10,10), figsize=3)
But I can't seem to plot **correctly** its numerical integral :
plot(lambda x:numerical_integral(lambda t:dunif(t,-1,1),-oo,x)[0], (x,-10,10
), figsize=3)
The problem is not a marginal display : I can zoom on (one of) the
problematic zone(s) :
lot(lambda x:numerical_integral(lambda t:dunif(t,-1,1),-oo,x)[0], (x,4,6),
figsize=3)
It is not a problem of "too much lambda" either : I have the same problem
after defining :
def punif(x,a,b):return(numerical_integral(lambda t:dunif(t,a,b),-oo,x)[0])
plot(lambda x:punif(x,-1,1), (x,4,6), figsize=3)
Same difference... I do not see an "obvious"* mistake* in what I coded ;
I'm aware that it's extremely ineffcient, that type conversions will occur
constantly and return a variety of types, etc... But this was only a
prototype for something more complicated, and I do not understand the
absurdity that sage spews on my screen in this absurdly simple case ("Hey,
sage : spewing absurdities is *my* job" :).
Note : what I pasted here comes from a 6.7beta0 ipython notebook. But I
reproduced it with 6.7beta0 notebook, 6.7beta0 command line, 6.7beta0 via
emacs, and with 6.6 (final) on notebook, ipython-notebook and command line.
Can some kind soul point me in the direction of my error(s), possibly with
an ndication of its (their) magnituds(s) ?
Sincerely,
--
Emmanuel Charpentier
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.