Ask Your Question
1

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

asked 2011-11-01 20:57:13 +0100

In Sage notebook v 4.6.1 I wrote:

var('theta')
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
1

answered 2011-11-04 11:08:55 +0100

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

Arrrgh!

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

Comments

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 12:52:23 +0100 )edit

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

Bill Page _ again gravatar imageBill Page _ again ( 2011-11-07 07:37:49 +0100 )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 10:50:55 +0100 )edit
0

answered 2011-11-01 22:03:13 +0100

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

plot(1,(x,0,3))
edit flag offensive delete link more

Comments

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 22:04:23 +0100 )edit

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

Jason Grout gravatar imageJason Grout ( 2011-11-04 14:15:36 +0100 )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 23:01:50 +0100 )edit
0

answered 2011-11-01 21:55:58 +0100

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 (?).

Compare

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

with

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

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 2011-11-01 20:57:13 +0100

Seen: 882 times

Last updated: Nov 04 '11