Comment #3 on issue 1872 by asmeurer: Shortcut functions
http://code.google.com/p/sympy/issues/detail?id=1872
Yes, use S(7)/3. S is a shortcut for sympify(), which converts anything
into a sympy expression. This will
ensure that you get the SymPy rational 7/3 instead of 2 or 2.5. Also, from
__future__ import division will
make 7/2 return 2.5. See also
http://docs.sympy.org/gotchas.html#python-numbers-vs-sympy-numbers.
The best way to do that is to raise an exception. In this case, you should
use ValueError, as in:
if u.dim != v.dim:
raise ValueError("Dimension of %s doesn't match dimension of %s" %
u.name, v.name)
or something like that.
By the way, it looks like using isympy will make your life easier. It
automatically does from __future__ import
division, creates common symbols, and if you have it installed, it uses
IPython, which has many useful
features of its own, such as tab completion. If Python works on your iPod
touch, then I would imagine that
you should be able to get iPython to work.
Also, I'm interested how our tests fare on your iPod. What are the results
if you run:
from sympy import *
test() # This will run the tests
doctest() # This will run the doctests
on your iPod?
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en.