Okay, so the following works: z = var('z') n = 2 @interact def _(f = ((z+1)^n-abs(z^n+1)), B=(2..10)): show(complex_plot(f, (-B,B), (-B,B)))
But the following doesn't: z = var('z') @interact def _(f = ((z+1)^n-abs(z^n+1)), n = (2..10), B=(2..10)): show(complex_plot(f, (-B,B), (-B,B))) On Monday, June 10, 2013 11:33:01 AM UTC-5, William wrote: > > On Mon, Jun 10, 2013 at 9:24 AM, <computati...@gmail.com <javascript:>> > wrote: > > Ah, that's unfortunate. Might be a fun summer project to try to > implement, > > if I knew where to start. > > 1. http://www.sagemath.org/development.html > > 2. SAGE_ROOT/devel/sage/sage/plot/complex_plot.pyx which I found by > doing search_src('complex_plot') > > > On another note: I really like the @interact annotation. I'm messing > around > > with it, because I would like to add another parameter to my plot - an > > integer representing an index in a discrete family of functions. But I > keep > > getting python errors about my expression not being symbolic when I try > to > > include an integer parameter (like n = var('n'), then passing in n=2). > Any > > tips? > > Just put > > n = 2 > > instead? You have to post code for a more useful answer.... > > > > > On Monday, June 10, 2013 11:13:41 AM UTC-5, William wrote: > >> > >> On Mon, Jun 10, 2013 at 9:09 AM, <computati...@gmail.com> wrote: > >> > Thanks, this is exactly what I was looking for! > >> > > >> > In fact, I had tried out complex_plot but I must have been using a > >> > different > >> > color function or something, because the roots were much less > apparent > >> > to > >> > me. Not sure why I couldn't figure this out on my own... > >> > > >> > I suppose I have two follow-up questions now: > >> > 1. how can I improve the precision of the zero set (it seems to be > drawn > >> > in > >> > low resolution right now) > >> > >> Use plot_points: > >> > >> f(z) = z - abs(z) > >> complex_plot(f, (-3,3), (-3,3), plot_points=200) > >> > >> > 2. what is the best way to "turn off" the other colors (draw > non-zeros > >> > as > >> > white) > >> > >> I don't know if this is possible or implemented at present. > >> > >> > > >> > On Monday, June 10, 2013 10:02:12 AM UTC-5, William wrote: > >> >> > >> >> On Sun, Jun 9, 2013 at 3:25 PM, <computati...@gmail.com> wrote: > >> >> > Suppose I have a complex function f(z) with a continuous family of > >> >> > zeros > >> >> > (e.g., f(z)=z-|z|) > >> >> > > >> >> > Is there a way to easily plot the set of zeros of f in sage, > >> >> > regardless > >> >> > of how complicated the function f is? > >> >> > > >> >> > >> >> You might find complex_plot useful. For example, for > >> >> > >> >> f(z) = z - abs(z) > >> >> complex_plot(f, (-3,3), (-3,3)) > >> >> > >> >> you'll see a *black line* at the zero set of f(z). > >> >> > >> >> In the notebook you mind find an interact like this useful: > >> >> > >> >> > >> >> z = var('z') > >> >> @interact > >> >> def _(f = z-abs(z), B=(2..10)): > >> >> show(complex_plot(f, (-B,B), (-B,B))) > >> >> > >> >> Or just click on > >> >> > >> >> http://sagecell.sagemath.org/?q=cdcdd7e5-73b4-4c87-87e2-1be300f86674 > >> >> > >> >> > -- > >> >> > 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?hl=en. > >> >> > For more options, visit https://groups.google.com/groups/opt_out. > >> >> > > >> >> > > >> >> > >> >> > >> >> > >> >> -- > >> >> William Stein > >> >> Professor of Mathematics > >> >> University of Washington > >> >> http://wstein.org > >> > > >> > -- > >> > 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?hl=en. > > >> > For more options, visit https://groups.google.com/groups/opt_out. > >> > > >> > > >> > >> > >> > >> -- > >> William Stein > >> Professor of Mathematics > >> University of Washington > >> http://wstein.org > > > > -- > > 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 <javascript:>. > > To post to this group, send email to > > sage-s...@googlegroups.com<javascript:>. > > > Visit this group at http://groups.google.com/group/sage-support?hl=en. > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > > > > -- > William Stein > Professor of Mathematics > University of Washington > http://wstein.org > -- 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+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support?hl=en. For more options, visit https://groups.google.com/groups/opt_out.