I jumped over from the sage-support group, where I had posted a
question about graphing x^(1/3).  Alex Ghitza's response to me made
more sense when I read the background discussion here.

I am experiencing the same inconsistency revealed in the latter part
of this discussion.  I am also running Sage locally on a MacOS X PPC
G4 machine, and it graphs plot(x^(1/2)) just as I expected.  I was
stumped when I uploaded my worksheet to sagenb.org, and got the same
error message for the square root function, which I thought was
restricted in some way to cube roots.  (I'm a novice.)

Ditto on the inconsistency of plotting log(x) and math.sqrt(float(-1))
-- which produces nan on my machine, and an error message on
sagenb.org.  I thoroughly agree with kcrisman's reasoning that a
implied real range is a feature, not a bug, for plotting.

Andy


On Feb 21, 7:03 am, kcrisman <[EMAIL PROTECTED]> wrote:
> Sorry I never attached the graphic - it's on my desktop, but the
> Google Groups help leads me to believe someone has turned off file
> posting on this group (on sage-support it seems to still be available,
> though, given recent posts).
>
>
>
> > OK, now I'm curious.  I still get errors (with 2.10.1 and with
> > 2.10.2.alpha0), as do a couple of people I asked to test this on IRC.
>
> > What OS/architecture are you using?
>
> Mac OSX.4, PowerPC G4
>
> > Do you get different results than this:
> > sage: import math
> > sage: math.sqrt(float(-1))
> > ---------------------------------------------------------------------------
> > <type 'exceptions.ValueError'>            Traceback (most recent call
> > last)
>
> > /home/cwitty/sage/<ipython console> in <module>()
>
> > <type 'exceptions.ValueError'>: math domain error
>
> Yes, I do!
>
> sage: import math
> sage: math.sqrt(float(-1))
> nan
>
> My computer's native Python installation also provides:
>
> Python 2.3.5 (#1, Mar 20 2005, 20:38:20)
> [GCC 3.3 20030304 (Apple Computer, Inc. build 1809)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.>>> 
> import math
> >>> math.sqrt(float(-1))
>
> nan
>
> So presumably plot is somehow using this.  Personally, I think this is
> a feature, not a bug - if one specifies an implied real range for a
> function, non-real outputs should just be ignored, which should avoid
> the messing up of internal calculations that having a "real" method or
> something would imply.  For instance, on the same computer, the
> following plots something nice and without complex branches or
> something weird like that:
>
> sage: show(plot(log(x),-5,5))
>
> While looking into this I discovered:
>
> sage: log(0)
> ---------------------------------------------------------------------------
> <type 'exceptions.TypeError'>
> [lots of stuff]
> <type 'exceptions.TypeError'>: error evaluating "log(0)":
> Error executing code in Maxima
> CODE:
>         log(0);
> Maxima ERROR:
> log(0) has been generated.
>
> Presumably log(0) should provide a more helpful (and much shorter)
> error message.  And what does this phrase, "log(0) has been
> generated," mean?
>
> - kcrisman

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to