You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sympy
Hi
Given an expression like Eq(a/b,c), how can I manipulate both lhs and rhs together? It would be useful if something like b*Eq(a/b,c) can become Eq(a,b*c).
Thanks
Blair
Shekhar Prasad Rajak
unread,
Dec 16, 2016, 9:09:39 AM12/16/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sympy
You can do this :
```
In [7]: cancel(y*(x/y)-z)
Out[7]: x - z
```
--
Shekhar
bsdz
unread,
Dec 16, 2016, 9:36:36 AM12/16/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sympy
But that doesn't work with Eq. Also how would that work if I wish to do ln(Eq(a*b,c))? Converting the expression to form lhs-rhs wouldn't work.
Shekhar Prasad Rajak
unread,
Dec 18, 2016, 5:01:07 AM12/18/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sympy
Convert that into lhs - rhs form and try :
In [39]: eq = Eq(x/y,z).lhs - Eq(x/y, z).rhs
In [40]: eq
Out[40]:
x
─ - z
y
bsdz
unread,
Dec 18, 2016, 5:29:49 AM12/18/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sympy
Not quite what I'm asking but thanks anyhow :)
Chris Smith
unread,
Dec 22, 2016, 2:48:02 PM12/22/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sympy
This has been discussed from time to time. Basically you have to roll your own:
```
>>> e=Eq(x,y)
>>> e
Eq(x, y)
>>> do=lambda e,g: e.func(g(e.lhs),g(e.rhs))
>>> do(e,lambda _:_*3)
Eq(3*x, 3*y)
>>> do(_,lambda _:_/3)
Eq(x, y)
```
Aaron Meurer
unread,
Dec 22, 2016, 2:49:43 PM12/22/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message