On Jan 27, 7:51 am, Andrea Gobbi <andreamat...@gmail.com> wrote: > Hi! > Maybe I resolve it...: > > def deriv(self, *args,**kwds): print args, kwds; return w(x) > f(x)=-x*x*x+1 > w(x)=sin(x)/x > tc=3 > def ef(self,x,parent=None): > return numerical_integral(w,tc,x)[0] > g=function('g',nargs=1,evalf_func=ef,derivative_func=deriv) >
Believe it or not, it wouldn't be too much harder to implement the sine integral Si(x) for Sage in general - as long as we had a reliable evaluation function in Pari, Scipy, mpmath, or somewhere. mpmath at least has it: http://mpmath.googlecode.com/svn/trunk/doc/build/functions/expintegrals.html#si I can't believe we don't have this already. Am I missing something - can someone else confirm this (though search_src and a Google search revealed nothing, and none of the usual suspects in sage/functions have it)? - kcrisman > In this way i can correctly compute for example the derivative of > f(integral(w)) as: > (diff(f(g(x)),x,1) > And the value assumed for example in 4 > (diff(f(g(x)),x,1)(4).n()) > > and this works also for n-th-derivative. > > I apologize if you waste time :-) > Thanks! > Andrea Gobbi > > > > ---------- Forwarded message ---------- > From: Andrea Gobbi <andreamat...@gmail.com> > Date: 2011/1/26 > Subject: Integral functions > To: sage-support <sage-support@googlegroups.com> > > Hi! > I have a question...I'm working with integral functions: > > var('t,x') > f(t)=t^2 > F(x)=integral(f,t,0,x) > > and obviously: > > F(x).derivative() give x^2 as result. > > Now the question is: can i have the same result if f doesn't admit a > primitive? I think that when sage "sees" integral(f,t,0,x), tries to > compute a primitive G and then assigns to F the difference between > G(x) and G(0). In this way when i try to calculate the derivative of > F, the result is f. > For example: > > var('t,x') > f(t)=t^2 > F(x)=integral(sin(t)/t,t,1,x,assume(x>1)) > > I look at the reference manual and I find a section in which we can > force a funcion to have a rule for the derivation (pag. 252) but I > don't understand how to do this. Sorry for my awful english! > Thank you! > Best regards! > Andrea Gobbi > > -- > Andrea Gobbi -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org