As noted, this will work if you make `x` real. You can also state the
equation as an Equality and solve it:
>>> var('x', real=True)
x
>>> solve(Eq(abs(2*x -4), 14))
[-5, 9]
/c
On Saturday, October 5, 2019 at 1:52:15 AM UTC-5, Steve F wrote:
>
> Hello,
>
> I am new to Python and Sympy and have looked around the web for a good
> bit and found a solution to this problem
>
> Solve: Abs(2*x -4) =14.
>
> I could do it this way:
>
> #Solving a single Linear Equation for X.
> #https://docs.sympy.org/latest/modules/solvers/solvers.html
> from sympy.solvers import solve
> from sympy import Symbol
> x = Symbol('x')
> solve(2*x - 4 -14,x)
>
> and
>
> #Solving a single Linear Equation for X.
> #https://docs.sympy.org/latest/modules/solvers/solvers.html
> from sympy.solvers import solve
> from sympy import Symbol
> x = Symbol('x')
> solve(2*x -4 + 14,x)
>
> But I wonder if there is a better way.
>
> Also, I would like to plot this in Jupyter Lab/Python.
>
> Thank you,
> Steve.
>
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/9c3e999a-2418-4443-bbde-20b1f8e2cea8%40googlegroups.com.