ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 25 May 2013 04:10:59 +0200How to combine the @interact command with complex plot?https://ask.sagemath.org/question/10150/how-to-combine-the-interact-command-with-complex-plot/How to combine the @interact command with complex plot?
Hi, I'm trying to create a code to combine the @interact command with complex plot. I have created the complex plot using
sage: f(z) = z^5 + z - 1 + 1/z
sage: complex_plot(f, (-3, 3), (-3, 3))
but I wish to change the z^5 term to z^x where I can create a slider for the value of x using the @interact command.
Does anyone know how I should start with this?
I'm currently a high student working for a project but I don't know much about sage. If you know anything and can explain in simple terms it will be greatly appreciated.
THANK YOUFri, 24 May 2013 22:33:16 +0200https://ask.sagemath.org/question/10150/how-to-combine-the-interact-command-with-complex-plot/Answer by vdelecroix for <p>How to combine the @interact command with complex plot?
Hi, I'm trying to create a code to combine the @interact command with complex plot. I have created the complex plot using </p>
<pre><code>sage: f(z) = z^5 + z - 1 + 1/z
sage: complex_plot(f, (-3, 3), (-3, 3))
</code></pre>
<p>but I wish to change the z^5 term to z^x where I can create a slider for the value of x using the @interact command.
Does anyone know how I should start with this?
I'm currently a high student working for a project but I don't know much about sage. If you know anything and can explain in simple terms it will be greatly appreciated.
THANK YOU</p>
https://ask.sagemath.org/question/10150/how-to-combine-the-interact-command-with-complex-plot/?answer=14971#post-id-14971Hi,
You should have a look at the documentation of interact. You can access the documentation with
sage: interact?
For your specific example, you can do
var('z')
@interact
def my_interact(a=(1,5,1)):
f(z) = z^a + z - 1 + 1/z
complex_plot(f, (-3, 3), (-3, 3)).show()
Sat, 25 May 2013 04:10:59 +0200https://ask.sagemath.org/question/10150/how-to-combine-the-interact-command-with-complex-plot/?answer=14971#post-id-14971