Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Sage doesn't (yet) have symbolic boolean functions (but see Trac#31911...). But since :

sage: f(0,y)
0
sage: f(x,0)
0

we can write :

sage: h(x,y)=cases([(x==0, 0), (y==0, 0), (True, f(x,y))])

which is defined at 0.

But plotting $h$ has the same problem as plotting $f$ : the "big cross", is a plotting artefact, resulting from the way Sage computes the numerical values of points to be plotted.

The workaround would be to compute explicit expression for your level curves and plot them. This is left to the reader as an exercise ;-))...

HTH

Sage doesn't (yet) have symbolic boolean functions (but see Trac#31911...). But since :

sage: f(0,y)
0
sage: f(x,0)
0

we can write :

sage: h(x,y)=cases([(x==0, 0), (y==0, 0), (True, f(x,y))])

which is defined at 0.

But plotting $h$ has the same problem as plotting $f$ : the "big cross", is a plotting artefact, resulting from the way Sage computes the numerical values of points to be plotted.

The workaround would be to compute explicit expression for your level curves and plot them. This is left to the reader as an exercise ;-))...

HTH

HTH,

EDIT : In your case, this might not be necessary ; writing your function in polar coordinates being enough to get an expression with no singularities at $(0,0)$ :

sage: var("r, theta")
(r, theta)
sage: g(r,theta)=f(x,y).subs({x:r*cos(theta), y:r*sin(theta)}).simplify_full() ; g
(r, theta) |--> (2*r^2*cos(theta)^3 - r^2*cos(theta))*sin(theta)
sage: g(0, theta)
0

HTH,