plot sqrt(sin(x))

i like this post (click again to cancel)
1
i dont like this post (click again to cancel)

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

plot(sqrt(sin(x)),(0,10))

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

asked Apr 03 '11

Georg Damm gravatar image Georg Damm
41 2 5

2 Answers:

i like this answer (click again to cancel)
2
i dont like this answer (click again to cancel)

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

maxima.plot2d(sqrt(sin(x)),[x,0,10])

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

link

posted Apr 03 '11

parzan gravatar image parzan
848 3 12 30

updated Apr 03 '11

This is a good workaround - thanks :) But I consider it still a bug - any objections? How can this be used in sagetex? Georg Damm (Apr 03 '11)
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 (Apr 05 '11)
i like this answer (click again to cancel)
0
i dont like this answer (click again to cancel)

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.

link

posted Apr 04 '11

kcrisman gravatar image kcrisman
6614 13 66 149

Your answer

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
[hide preview]

Question tools

Tags:

Stats:

Asked: Apr 03 '11

Seen: 224 times

Last updated: Apr 04 '11

powered by ASKBOT version 0.7.22
Copyright Sage, 2010. Some rights reserved under creative commons license.