Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hi,

sage is correct saying that a negative number cannot be raised to a fractional power IF you want to plot it. For example

f(-2)=-1/2*sqrt(-2)
f(2)=sqrt(2)

The first one is imaginary, the other one real, so you cannot plot both in the same 2D plot. You could use the abs() function to avoid this problem. Another thing is

sage: f(x).limit(x=0,dir='+')
0
sage: f(x).limit(x=0,dir='-')
+Infinity

so that your plot for either f or g will have a huge peak which will suppress the rest of the plot. Try the following:

sage: f1(x)=x^(1/x)
sage: f2(x)=(-x)^(1/x)
sage: p1=plot(f1(x),0,5)
sage: p2=plot(f2(x),-5,-0.5)
sage: show(p1+p2)