B
B
badmaev972016-11-02 16:00:33
Python
badmaev97, 2016-11-02 16:00:33

How to do symbolic calculations in python?

I downloaded ANACONDA and decided to mess around a bit. Symbolic calculations fail in Python 3.5. This error comes up when importing from sympy: module' object is not callable.
Can you show the code with some simple example? (For example, taking the derivative of x^2 in symbolic form). And I'm a total noob at programming.
Here is the piece of code itself:
from sympy import symbo.
from sympy import diff
x=symbol('x')
y=x**2
print(diff(y,x))

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Daniil Kolesnichenko, 2016-11-02
@badmaev97

from sympy import var

var('x')
y = x**2
print(y.diff(x))  # => 2*x

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question