On Sat, Apr 9, 2016 at 3:13 AM, Amy Valhausen <[email protected]> wrote:
>
> Hi Aaron!  I have been trying to follow your suggestions to try
>
> mpmath.phi & sympy.GoldenRatio but I keep getting command line errors when I
> try to reference these.

These are referencing the names from the modules. To get
sympy.GoldenRatio you first need to run

import sympy

Alternately, you can run

from sympy import GoldenRatio

and just use "GoldenRatio". Or you can run

from sympy import *

and it will import all the functions from SymPy (including GoldenRatio).

>
> When I enter this at the command line for example ;
>
> (1/GoldenRatio**4*514229).evalf()
>
> It errors out - I suspect I am not referencing it properly or defining it
> somehow?
>
> I tried looking this up on a number of sites online, the best links I could
> find
> were these ones ; http://nullege.com/codes/search/sympy.GoldenRatio
>
> and http://www.programcreek.com/python/example/23863/sympy.GoldenRatio

Those don't seem like great resources. They are just finding instances
of "GoldenRatio" from SymPy's source code.

I would recommend using docs.sympy.org.  Here are the docs for
GoldenRatio 
http://docs.sympy.org/latest/modules/core.html#sympy.core.numbers.GoldenRatio
(note that S.GoldenRatio is an additional way to access it).

>
> I find the references a bit confusing, am I supposed to define them as
> and 'abs' type, or do I use the key word 'assert' before it?
>
> Is sympy.GoldenRatio an mpmath function?
>
> Do I have to import mpmath before I use "sympy.GoldenRatio"  what is the
> difference between "sympy.GoldenRatio" and mpmath.phi ?

mpmath is a purely numeric library. It is used internally by SymPy.
You do not need to import mpmath unless you want to use it explicitly.
If you use SymPy functions, they will use mpmath internally
automatically. I would recommend just using SymPy, unless you have a
specific reason to use mpmath (for instance, you want to use a mpmath
function that isn't implemented in SymPy).

SymPy represents things symbolically, and can do symbolica
manipulation. For instance

In [23]: expand_func(GoldenRatio)
Out[23]:
1   √5
─ + ──
2   2

This is not possible with mpmath because mpmath just represents the
golden ratio as the number 1.61803398874989.

>
> Also do you know what the numeric value limit of the argument I pass to
> "evalf()" is?  Can I pass it up to 6000 as a value?

You can pass whatever number you want. You can use it to compute a
billion digits of the golden ratio if you want. The algorithms
implemented work with arbitrary precision, meaning you can pick any
number of digits and it will compute with that many (limited by your
computer's memory of course).

Aaron Meurer

>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/c906cb9a-d348-4377-8278-2367a976bf2b%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6JvHBFaj62xtS1f%3Dqy%3Du3dDG6Zh%2BUoMmviwDGEUJrckpw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to