How to plot output of solve()?

32 views
Skip to first unread message

David Ingerman

unread,
Jun 10, 2014, 2:48:08 AM6/10/14
to sage-s...@googlegroups.com
 
 How to plot output of solve() on coordinate plane?
For example: show((solve([mu^6==1],mu))) gives symbolic LaTex output

 Thank you...

P Purkayastha

unread,
Jun 10, 2014, 4:57:40 AM6/10/14
to sage-s...@googlegroups.com
I suppose you want to plot the complex numbers that are the roots. You can do the following:

list_plot([CDF(s.rhs()) for s in solve([mu^6==1],mu)])

Once #16378 ( http://trac.sagemath.org/ticket/16378 ) is fixed, you will not need to coerce to CDF, and so the following will also work (as long as there is at least one complex number in the list of solutions):

list_plot([s.rhs() for s in solve([mu^6==1],mu)])

Андрей Ширшов

unread,
Jun 10, 2014, 6:12:07 AM6/10/14
to sage-s...@googlegroups.com
Hello!
mu = var('mu')
L
= [t.rhs() for t in solve([mu^6==1],mu)]
Coords = [(real(t), imag(t)) for t in L]
P
= point(Coords, size=50)
P
.set_aspect_ratio(1)
P
.show()
Please see result in attachment.

вторник, 10 июня 2014 г., 10:48:08 UTC+4 пользователь David Ingerman написал:
Image 002.png

David Ingerman

unread,
Jun 10, 2014, 10:54:40 PM6/10/14
to sage-s...@googlegroups.com
 How did you get the .png picture? SageMath Cloud gives .svg files as output... 

William Stein

unread,
Jun 10, 2014, 11:29:10 PM6/10/14
to sage-support support

Do P.save('a.png')

--
You received this message because you are subscribed to the Google Groups "sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
To post to this group, send email to sage-s...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Андрей Ширшов

unread,
Jun 11, 2014, 3:09:35 AM6/11/14
to sage-s...@googlegroups.com
To be honest it was just screenshot...
Picpick on windows 7 or shutter on Linux.

среда, 11 июня 2014 г., 6:54:40 UTC+4 пользователь David Ingerman написал:
Reply all
Reply to author
Forward
0 new messages