Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #1033 from smichr/root-doc

add note about real_root to root function
  • Loading branch information...
commit 2f0cdaa7cb43adcd27ef92b4a6305e2e5c7fda95 2 parents af94f46 + 89a402f
Christopher Smith smichr authored
2  doc/src/modules/physics/mechanics/examples.txt
@@ -323,7 +323,7 @@ Assignment the relevant points to each body. ::
323 323 >>> BodyWR.mc = WR_mc
324 324
325 325 Sets the inertias of each body. Uses the inertia frame to construct the inertia
326   -dyadics. Wheel inertias are only defined by principle moments of inertia, and
  326 +dyadics. Wheel inertias are only defined by principal moments of inertia, and
327 327 are in fact constant in the frame and fork reference frames; it is for this
328 328 reason that the orientations of the wheels does not need to be defined. The
329 329 frame and fork inertias are defined in the 'Temp' frames which are fixed to the
21 sympy/functions/elementary/miscellaneous.py
@@ -68,7 +68,7 @@ def sqrt(arg):
68 68 >>> x.subs(x, -1)
69 69 -1
70 70
71   - This is because sqrt computes the principle square root, so the square may
  71 + This is because sqrt computes the principal square root, so the square may
72 72 put the argument in a different branch. This identity does hold if x is
73 73 positive:
74 74
@@ -148,6 +148,24 @@ def root(arg, n):
148 148 >>> [ RootOf(x**4-1,i) for i in (0,1,2,3) ]
149 149 [-1, 1, -I, I]
150 150
  151 + SymPy, like other symbolic algebra systems, returns the
  152 + complex root of negative numbers. This is the principal
  153 + root and differs from the text-book result that one might
  154 + be expecting. For example, the cube root of -8 does not
  155 + come back as -2:
  156 +
  157 + >>> root(-8, 3)
  158 + 2*(-1)**(1/3)
  159 +
  160 + The real_root function can be used to either make such a result
  161 + real or simply return the real root in the first place:
  162 +
  163 + >>> from sympy import real_root
  164 + >>> real_root(_)
  165 + -2
  166 + >>> real_root(-32, 5)
  167 + -2
  168 +
151 169 See Also
152 170 ========
153 171
@@ -162,6 +180,7 @@ def root(arg, n):
162 180 * http://en.wikipedia.org/wiki/real_root
163 181 * http://en.wikipedia.org/wiki/Root_of_unity
164 182 * http://en.wikipedia.org/wiki/Principal_value
  183 + * http://mathworld.wolfram.com/CubeRoot.html
165 184
166 185 """
167 186 n = sympify(n)
4 sympy/solvers/solvers.py
@@ -1992,7 +1992,7 @@ def _invert(eq, *symbols, **kwargs):
1992 1992 (0, sqrt(x) + y)
1993 1993
1994 1994 If there is more than one symbol in a power's base and the exponent
1995   - is not an Integer, then the principle root will be used for the
  1995 + is not an Integer, then the principal root will be used for the
1996 1996 inversion:
1997 1997
1998 1998 >>> invert(sqrt(x + y) - 2)
@@ -2001,7 +2001,7 @@ def _invert(eq, *symbols, **kwargs):
2001 2001 (4, x + y)
2002 2002
2003 2003 If the exponent is an integer, setting ``integer_power`` to True
2004   - will force the principle root to be selected:
  2004 + will force the principal root to be selected:
2005 2005
2006 2006 >>> invert(x**2 - 4, integer_power=True)
2007 2007 (2, x)

0 comments on commit 2f0cdaa

Please sign in to comment.
Something went wrong with that request. Please try again.