Ask Your Question

polar_plot((1/sin(theta)),(theta, pi/12, pi/2))

asked 2011-11-01 14:57:13 -0500

In Sage notebook v 4.6.1 I wrote:

polar_plot((1/sin(theta)),(theta, pi/12, pi/2))

I got

libpng error: Image width or height is zero in IHDR
Traceback (click to the left of this block for traceback)
RuntimeError: Error building image

What am I doing wrong?

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted

answered 2011-11-04 05:08:55 -0500

Thanks for the trac ticket.

Here is another one with a problem:

polar_plot(3*sqrt(cos(2*theta)),(theta, 0, 2*pi))

gives the follow graph:

> ![image description](http://)
> Sorry, file uploading requires karma > 60


Well, ok try it yourslf. On my v.4.6.1 worksheet I see a plot with some weird discontinuity near the origin.

edit flag offensive delete link more


This is a different issue that is not really solvable in the same way. Try `polar_plot(3*sqrt(cos(2*theta)),(theta, 0, 2*pi),plot_points=50000)` for something that looks pretty good, though.

kcrisman gravatar imagekcrisman ( 2011-11-04 06:52:23 -0500 )edit

Ok, yes with this option I do get a reasonable looking graph but I also get the message: verbose 0 (3998:, generate_plot_points) WARNING: When plotting, failed to evaluate function at 24999 points. verbose 0 (3998:, generate_plot_points) Last error message: ''

Bill Page _ again gravatar imageBill Page _ again ( 2011-11-07 00:37:49 -0500 )edit

Yeah, but that's ok. I mean, you should have gotten that error for the one without the `plot_points` option set as well. That is because you are plugging in `theta` that give you a negative number inside the square root :) and plot ignores them but tells you that some of its points did that.

kcrisman gravatar imagekcrisman ( 2011-11-07 03:50:55 -0500 )edit

answered 2011-11-01 15:55:58 -0500

kcrisman gravatar image

This isn't a full answer, but I think that there is something wrong with how we are doing the axes for polar plot - probably because of our aspect ratio handling (?).


sage: polar_plot(1/sin(1.01*theta),(theta, pi/12,pi/2))


sage: polar_plot(1/sin(1.001*theta),(theta, pi/12,pi/2))

and you'll see what I mean.

This is now Ticket 11978.

edit flag offensive delete link more

answered 2011-11-01 16:03:13 -0500

Jason Grout gravatar image

I don't get an error, but I do get plots that are very stretched out. Even with

polar_plot((1/sin(theta)),(theta, pi/12, pi/2),aspect_ratio='auto')

the y-axis isn't as nice as when we do

edit flag offensive delete link more


Really, you don't get an error? Your polar plot command gives me `TypeError: can't multiply sequence by non-int of type 'float'`.

kcrisman gravatar imagekcrisman ( 2011-11-01 16:04:23 -0500 )edit

I am running 4.7.2 alpha3, I think. What version are you running?

Jason Grout gravatar imageJason Grout ( 2011-11-04 08:15:36 -0500 )edit

I was using 4.7.1, I think. Let me try... Yup, that part at least is fixed somewhere in 4.7.2.

kcrisman gravatar imagekcrisman ( 2011-11-04 17:01:50 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2011-11-01 14:57:13 -0500

Seen: 403 times

Last updated: Nov 04 '11