Converting/evaluating surd to float [ANSWER]

22 views
Skip to first unread message

Brendan Arnold

unread,
Jul 11, 2008, 9:32:13 AM7/11/08
to sage-s...@googlegroups.com
Hi there,

Q: How do you evaluate or convert a surd value generated by SAGE into
numerical output?

A: Use the .n() method. i.e.

sage: sin(10)
sin(10)
sage: sin(10).n()
-0.544021110889370

This bugged me for ages when trying to export data to another program.

Perhaps this should be made clearer in the tutorial? (its only used
once and as an aside)

Brendan Arnold

Robert Bradshaw

unread,
Jul 11, 2008, 12:18:42 PM7/11/08
to sage-s...@googlegroups.com

Yes, for sure.

Another option is to do

sage: sin(10.0)
-0.544021110889370
sage: sin(10.000000000000000000000000000000000000000000)
-0.54402111088936981340474766185137728168364301

- Robert


Jason Grout

unread,
Jul 11, 2008, 12:55:27 PM7/11/08
to sage-s...@googlegroups.com


It sounds like this could be added to the FAQ if it's not already there.
You could add it:

http://wiki.sagemath.org/faq

Jason

John Cremona

unread,
Jul 11, 2008, 1:00:06 PM7/11/08
to sage-s...@googlegroups.com
I don't think that sin(10) is a "surd", though it is certainly
irrational and probably even transcendental.

If you look up definitions of "surd" online you get a quite incredible
collection of conflicting answers, many of which (even in high school
revision guides) are almost complete nonsense. But one thing I am
confident about is that surds are algebraic!

This is not strictly relevant to the point made by Brendan, but please
can we have this put into the FAQ without using the word "surd"? You
could change "surd value" to "symbolic value" here.

John Cremona

2008/7/11 Jason Grout <jason...@creativetrax.com>:

John H Palmieri

unread,
Jul 11, 2008, 6:01:29 PM7/11/08
to sage-support


On Jul 11, 10:00 am, "John Cremona" <john.crem...@gmail.com> wrote:
> I don't think that sin(10) is a "surd", though it is certainly
> irrational and probably even transcendental.
>
> If you look up definitions of "surd" online you get a quite incredible
> collection of conflicting answers, many of which (even in high school
> revision guides) are almost complete nonsense.   But one thing I am
> confident about is that surds are algebraic!
>
> This is not strictly relevant to the point made by Brendan, but please
> can we have this put into the FAQ without using the word "surd"?  You
> could change "surd value" to "symbolic value" here.
>
> John Cremona
>
> 2008/7/11 Jason Grout <jason-s...@creativetrax.com>:
>
>
>
> > Brendan Arnold wrote:
> >> Hi there,
>
> >> Q: How do you evaluate or convert a surd value generated by SAGE into
> >> numerical output?
>
> >> A: Use the .n() method. i.e.
>
> >> sage: sin(10)
> >> sin(10)
> >> sage: sin(10).n()
> >> -0.544021110889370
>
> >> This bugged me for ages when trying to export data to another program.
>
> >> Perhaps this should be made clearer in the tutorial? (its only used
> >> once and as an aside)
>
> > It sounds like this could be added to the FAQ if it's not already there.
> >  You could add it:
>
> >http://wiki.sagemath.org/faq
>
> > Jason

Here's a proposed patch for the tutorial:

<http://trac.sagemath.org/sage_trac/ticket/3645>

It should be quick to review.

Reply all
Reply to author
Forward
0 new messages