when I must declare f= or f(x,y)= ?
HI
Sorry for this really basic SageMath question ;-( :
Does anyone know the reason why an error is generated when I uncomment the 3rd line? and is it possible when a function was declared (f(x)=) object to return to (f=) object ? and when I must declare f(x)= , or simply f= ? despite the reading of Some Common Issues with Functions
var('x')
SGN=(x+2)*(x+1)*(x-1)*(x+1)
#SGN(x)=(x+2)*(x+1)*(x-1)*(x+1)
show(SGN.parent())
f(x)=1/x*sin(x)
plt=plot(f,(x,-3,3),color='blue')
plt+=plot(SGN,(x,-3,3),color='black',linestyle='dashed')
plt+=plot(sgn(SGN),(x,-5,5),color='gray',linestyle='dashed')
show(plt,xmin=-2,xmax=2,ymin=-3,ymax=3, aspect_ratio=1)
show(numerical_integral(f,0,2)[0])
show(numerical_integral(-sgn(SGN)*f,0,1)[0]+numerical_integral(sgn(SGN)*f,1,2)[0])
The problem is with
sgn(SGN)
; this is an inconsistency / missing feature in Sage, because things likecos(SGN)
andlog(SGN)
work fine. I reported this as trac ticket #31282.