Il giorno mercoledì 31 ottobre 2018 10:11:34 UTC+1, Francesco ha scritto:
>
> Hello; I  have installed sage 8.4 and I have problem with the derivatives 
> ...
> I have defined a function in sage of this type:
>
> x=var('x')
> def funz(x):
>    if x >= 0:
>       return x^2
>    else:
>       return x^3
>  
> but, when I try to calculate
>
> diff(funz(x),x)
>
> I obtain only
>
>  3x^2
>
> and this is wrong !! Can you help me ?
>

Ok,  the piecewise-defined functions can be written with the sign(x) 
function. The funz(x) can be written as:

funz(x)=(x^2)*(sign(x)+1)/2+(x^3)*(-sign(x)+1)/2

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to