0

this is the code that can insert an equal between two objects:

import sympy as sp
from sympy import pprint
y =sp.Symbol('y')
x=sp.Eq((((y**2+2)*(y**3))/5)+3,3*(y**2))
pprint(x,use_unicode=True)

it's the result:

 3 ⎛ 2    ⎞           
y ⋅⎝y  + 2⎠          2
─────────── + 3 = 3⋅y 
     5            

but if i wanna add another equal using another sp.Eq like this:

import sympy as sp
from sympy import pprint
y =sp.Symbol('y')
x=sp.Eq(sp.Eq((((y**2+2)*(y**3))/5)+3,3*(y**2)),0)
pprint(x,use_unicode=True)

the result is:

False
hpaulj
  • 221,503
  • 14
  • 230
  • 353
  • 2
    Please explain what you are trying to achieve? – DisappointedByUnaccountableMod Dec 23 '20 at 19:00
  • I am trying to put a three = in the function like a=b=c i can make only a=b but i can't put the three = – Magdy Rafeet Dec 23 '20 at 20:16
  • I can read that from your question, but my questionis ‘why’ do you want to put _two_ = in the function? Is this because you hope to solve the equations (in which case while it’s obvious that y=0 is a solution to b=c it’s less obvious there’s a solution to a=c(=0) and certainly not with y=0 so your ‘equality’ doesn’t appear possible)? – DisappointedByUnaccountableMod Dec 23 '20 at 20:23
  • I want to solve a rule with more than step so i want make more than = because then i want try to write it in a file docx – Magdy Rafeet Dec 23 '20 at 20:31
  • @MagdyRafeet are you trying to solve a system of equations [like this one](https://www.wolframalpha.com/input/?i=solve+%28%28%28y%5E2%2B2%29*%28y%5E3%29%29%2F5%29%2B3+%3D+3*%28y%5E2%29+%2C+3*%28y%5E2%29+%3D+0) ? – wsdookadr Dec 23 '20 at 21:12
  • No i don't need the result but i want to write the form of equation because i want to put it in Microsoft word – Magdy Rafeet Dec 23 '20 at 21:17
  • Alright, in that case, you could print the formulas/equations you want in [MathML format](https://docs.sympy.org/latest/tutorial/printing.html#mathml), and then copy the MathML string into Word [like this](https://stackoverflow.com/a/25448431/827519). That should allow you to embed SymPy formulas into Word. Can you try that and see if it works ? – wsdookadr Dec 23 '20 at 21:20
  • Okay I'll try. Thank you – Magdy Rafeet Dec 23 '20 at 21:23

1 Answers1

0

You can use evaluate=False:

In [7]: Eq(Eq(3, 4, evaluate=False), 2, evaluate=False)
Out[7]: 3 = 4 = 2
Oscar Benjamin
  • 12,649
  • 1
  • 12
  • 14