On Sat, Apr 9, 2016 at 3:13 AM, Amy Valhausen <
amy.vau...@gmail.com> 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).
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
>
https://groups.google.com/d/msgid/sympy/c906cb9a-d348-4377-8278-2367a976bf2b%40googlegroups.com.