The warnings aren't really errors.  The tangent to a circle is vertical in 
two places, and that's the same thing as saying "it has to be broken up 
into two pieces."  Sage will tell you those points can't be evaluated. 
 Many other programs (such as Mac OSX's free Grapher) will *suppress* these 
warnings because there is nothing wrong with the function.

To fix the problem, you can add another command which tells SAGE only to 
evaluate your circle from -2 to 2.  You can still set the xmin and xmax on 
your graph wherever you want.

The problem with what I wrote is that SAGE is actually trying to plot 
points at, say, x=2.4.  But, as you already know, there is no circle there!

Sorry if I made it more confusing.  Didn't want to add a lot of new 
commands and make it hard to see how they fit together.

In any case, there is nothing wrong with plotting functions one piece at a 
time, and really there's no way to avoid it.  You'll be stuck dealing with 
these issues every time you work with math.  Personally, I like to know 
what's going on, so that I can handle them myself, just in case the program 
doesn't want to play along.

For example, suppose you had a program that wasn't very accurate, and even 
though you *SAID* "can you please evaluate this from -2 to 2?" because of 
the way it divided up the interval [-2, 2], the last number it chose for *x* 
was 2.000000000001 
instead of 2.  The square root is negative, here's no circle there, and the 
program gives you an error.

This would not be your fault, and it would be a mistake to assume you 
"should not do it this way."

Right?

I mention it because Python is *exactly* such a language.  It tends to give 
you too many decimal places; some of which are no longer accurate.  The way 
to fix the problem, would be to evaluate the circle from, say
[  -1.9999    to   1.9999]

hahahahahaha, see?  Then the graph will be fine, and there will be no 
errors.  Even if it misses by a little bit, it won't pass 2, and everything 
is fine.  Sometimes this is the difference between a working graph and an 
error!

Hope that helps! 

On Sunday, June 24, 2012 9:12:35 PM UTC-7, Priyanka wrote:
>
> On Mon, Jun 25, 2012 at 7:39 AM, Slumberland <[email protected]> wrote: 
> > Okay, that's maybe not the answer you're looking for. 
> > 
> > What he means is that you can't plot it explicitly without solving for 
> y. 
> > "Implicit" is another way of saying 
> > "not in the form y = " 
> > (or z= , x =   .... etc) 
> > 
> > But it can be instructive to figure out how to plot the functions which 
> > define a circle.  Is that what you want? 
> > 
> > Sage will solve the equation for you.  You can type 
> > 
> > sage: x,y = var('x,y') 
> > sage: b = x^2 + y^2 == 4 
> > sage: c = solve(b,y) 
> > sage: c 
> > 
> > [y == -sqrt(-x^2 + 4), y == sqrt(-x^2 + 4)] 
> > 
> > 
> > The command "solve(b,y)" solves your equation for the variable y. 
> > 
> > Plotting this way is awkward but you can do it.  In this case, we need 
> each 
> > of the functions 
> > 
> >     -sqrt(-x^2+4), 
> > 
> >     sqrt(-x^2+4) 
> > 
> > 
> > Both of these are stored in c. 
> > 
> > To get them, you can tell python what parts you want: 
> > 
> > c[0].rhs() gives you the right-hand-side{ ;-) of the first equality 
> stored 
> > in c 
> > 
> > c[1].rhs() grabs the second. 
> > 
> > So, you could do this: 
> > 
> > 
> > sage: bottom = plot( c[0].rhs(), xmin=-3, xmax=3, aspect_ratio=1) 
> > 
> > sage: top = plot(c[0].rhs(), xmin=-3, xmax=3) 
> > 
> > sage: show(bottom+top) 
> > 
> > 
> > and the graph will show, but Python complains that it can't evaluate the 
> > function at some points. 
> > 
> > 
> >  implicit_plot() is easier to use, that's all. 
>
> Thanks for explaining the things . :-) It executed the code and it 
> gives half circle. Anyways if it gives warnings then we should not do 
> this way. 
> Thanks once again. 
>
>
>
> -- 
> Priyanka Kapoor 
> priyankacool10.wordpress.com 
> Linux User Group, Ludhiana 
>

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to