Dear All,

First I would like to thank for all the quick replies with very worked
through answers. It seems for now, that this answer came closest to
what I wanted.

I will use it for now and see where it goes.

Sincerely,
Bjorn


On Jan 6, 3:43 pm, Chris Smith <[email protected]> wrote:
> On Fri, Jan 6, 2012 at 4:52 PM, Bjorn <[email protected]> wrote:
> > Hi, I am new to sympy and I have a basic question.
> > I would like to use sympy to sovle simple sets of equations in a text
> > editor.
>
> > like given the following as plain text:
> > a = 10
> > b = 20
> > a * 12 + 50*c == 456 + b
>
> > and an instruction to solve for c, then ptorduce:
>
> > c = 7.12
>
> > I know sympy comes with a solver that can solve systems of f(x)=0,
> > but in the problem above the third equation needs to be rewritten for
> > this to work.
> > To me, this seems as something that might have been done before?
> > Id be grateful for directing me to a resource or telling me how or why
> > this is harder than it seems.
>
> Given a string with all three equations, it's not too hard to parse it up
> and prepare it for the solver with something like this:
>
> ```python>>> eqs='''
>
> ... a=10
> ... b=20
> ... a*12+50*c==456+b'''>>> new_eqs = [Eq(*[S(ei) for ei in 
> e.replace('==','=').split('=')]) for
>
> e in eqs.strip().splitlines()]>>> solve(new_eqs)
>
> {a: 10, b: 20, c: 178/25}
> ```

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" 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?hl=en.

Reply via email to