Ask Your Question

plot sqrt(sin(x))

asked 2011-04-02 22:55:53 -0500

Georg Damm gravatar image

is there a way to plot this kind of functions right?


verbose 0 (4069:, generate_plot_points) WARNING: When plotting, failed to evaluate function at 74 points. verbose 0 (4069:, generate_plot_points) Last error message: ''

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2011-04-02 23:37:58 -0500

parzan gravatar image

updated 2011-04-03 00:33:30 -0500

If you only want to get rid of the part where sin(x) is negative you can use


(write this in sage - it has a maxima interface built in).

However, since the values of sqrt(sin(x)) in these places are complex, a possibly better visualization of it is

complex_plot(sqrt(sin(x)), (0, 10), (-1, 1))

This is a strip around the range you are interested in. Here is an explanation of the output, from sage manual:

The magnitude of the output is indicated by the brightness (with zero being black and infinity being white) while the argument is represented by the hue (with red being positive real, and increasing through orange, yellow, ... as the argument increases).

This page demonstrates and explains some complex plots.

edit flag offensive delete link more


This is a good workaround - thanks :) But I consider it still a bug - any objections? How can this be used in sagetex?

Georg Damm gravatar imageGeorg Damm ( 2011-04-03 02:42:35 -0500 )edit

I agree that detecting the domain of definition is desirable (at least as an option), and since maxima does it it should be possible. I have no experience with sagetex so I can't help there.

parzan gravatar imageparzan ( 2011-04-05 12:59:06 -0500 )edit

answered 2011-04-04 04:57:43 -0500

kcrisman gravatar image

I think that the current best way to deal with your issue is to know ahead of time what the domain is.

sage: plot(sqrt(sin(x)),(x,0,pi))+plot(sqrt(sin(x)),(x,2*pi,3*pi))

Which isn't ideal, but could be enough for you.

However, I agree that the current behavior looks pretty bad, so Ticket 11123 is now dedicated to this.

As another workaround, you could do

sage: plot(sqrt(sin(x)),(0,10),plot_points=40000)

but even that looks not the greatest, and takes forever.

edit flag offensive delete link more


I should point out that [Ticket 13246]( has a patch for this issue, though it's not been included in Sage yet.

kcrisman gravatar imagekcrisman ( 2013-09-13 04:28:54 -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-04-02 22:55:53 -0500

Seen: 506 times

Last updated: Apr 04 '11