On Aug 8, 4:59 am, Jose Guzman <sjm.guz...@googlemail.com> wrote:
> To debug ticket #11653, I am trying to see the integral of the sing
> function,
>
> For that I do:
>
> sage: t=var('=t')
> sage: v=function('v',t)
>
> sage: myode =  diff(v,t) - ( sign(t) ) == 0
> sage: mysol = desolve(de=myose, ivar=t, dvar=y) # do not add ics
> argument, cause it fails, see ticket #11653

You had a number of typos, so it took a little bit to get this
right ;-)

sage: t = var('t')
sage: v = function('v',t)
sage: myode =  diff(v,t) - ( sign(t) ) == 0
sage: mysol = desolve(de=myode, ivar=t, dvar=v)
sage: mysol
c + integrate(sgn(t), t)



>
> it returns  c + integrate(sgn(t), t)
>
> Is it possible to plot this function? I tryed:
>
> sage: plot(mysol.subs(c=0))
>
> but it retuns
>       74         # Check for x
>       75         if not is_SymbolicVariable(x):
> ---> 76             if len(x.variables()) == 1:
>       77                 nx = x.variables()[0]
>       78                 f = f*x.diff(nx)
>
> AttributeError: 'float' object has no attribute 'variables'
>
> Note that other integrals are easy to plot
> sage: plot(integrate(sin(t),t), 0, 2*pi)
>
> Is this a bug (i.e the integral of the sign function is not
> implemented), or am I missing something here.

Well, one could consider that an enhancement request.  But that isn't
the problem here.

What happens is that the indefinite integral 'eval' function is called
twice - once to make the integral, then again to evaluate it at some
point for plotting.  But that second one now changes the 'variable' t
to some number (say, t=0) and that's not what the indef. integral
evaluator is prepared to do.

So we probably need to rewrite that somehow.  Here is an example that
shows it has nothing to do with signum:

sage: plot(integrate(e^(x^4 + x), x),0,1)

Of course, which antiderivative should we plot?   When Sage returns a
specific antiderivative, then this is at least clear, even if only one
of infinitely many possibilities; when not, as here, then there would
need to be some decision (presumably where F(0)=0 or something
arbitrary), plus some reasonably heavy numerical integration needed
for all those plot points.  I'm reluctant to open a ticket to do this
until there would be some mathematical clarity as to what the
'correct' thing to do is.

- kcrisman

-- 
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

Reply via email to