I want to do some simple calculation with variables. But this x
is not variable on often seen in programs, but x = unknown
in math formula.
I want calculate this
(x-1)^2 =
and get
x^2 - 4x + 4
is it possible??
I am familiar with some program language, but its first time to use math purpose.
As per Chen Guevara's comment here is a tiny snippet of sympy -using code to illustrate.
from sympy import symbols, expand
x = symbols('x')
expr = (x-1)**2
print(expr)
expr2 = expand(expr)
print(expr2)
This produces the output:
(x - 1)**2
x**2 - 2*x + 1
x = 8
quadratic = ((x ** 2) - (4 * x)) + 4
print(quadratic)
returns 36. is this what youre looking for?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.