On Mon, Apr 21, 2014 at 12:19 PM, jiju <[email protected]> wrote:
> Hi,
>
> I have successfully installed SymPiy. Consider the following python  script
> test.py with output -sin(x) as expected
>
> from sympy import *
> var('x')
> print diff(cos(x), x)
>
> I would like to pass diff(cos(x), x) as a command line argument to python
> script as python test.py  diff(cos(x), x). Could you help me in how to
> execute this then?
>
> I tried to use print os.system(sys.argv[1]) which is not working! Thanks in
> advance

Just do this:

import sys
from sympy import *
var("x")
print eval(sys.argv[1])


And call it like this (don't forget the quotes):

$ python test.py "diff(cos(x), x)"
-sin(x)


>
>
>
> --
> 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 http://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/adaf9c05-e5c3-4152-b13d-95bfd62ef6e4%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 http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CADDwiVC9-heb-22DLMWpXUFA7YprSn769b1cyHLZ%2BMvjA5HbCg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to