Groups
Groups
Sign in
Groups
Groups
sympy
Conversations
About
Send feedback
Help
Simplify, how return code instead of TeX?
23 views
Skip to first unread message
Michał Pawłowski
unread,
Feb 10, 2021, 10:43:44 AM
2/10/21
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
Hi.
I'd like to generate code of simplified formula. I.E:
When I pass: 1+x+x**2+x**3
I'd like to have: x**3+x**2+x+1
Is it possible to achieve it?
Thanks
Mike
gu...@uwosh.edu
unread,
Feb 10, 2021, 1:59:55 PM
2/10/21
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
wrap your expression in a `print()` statement: `print(1+x+x**2+x**3)`.
Michał Pawłowski
unread,
Feb 10, 2021, 2:20:38 PM
2/10/21
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
Thank you. It works in this example. But if I'd like to do this:
print((x**2+1)*(x-1))
It prints me string without compute it. I'd like to have :
x**3-x**2+x-1
Is it possible?
Thanks Mike
gu...@uwosh.edu
unread,
Feb 10, 2021, 2:22:09 PM
2/10/21
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
`print(expand(
(x**2+1)*(x-1)))`
Michał Pawłowski
unread,
Feb 10, 2021, 2:24:13 PM
2/10/21
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
Thank you very much! :)
Reply all
Reply to author
Forward
0 new messages