Loading [MathJax]/jax/output/HTML-CSS/jax.js

First time here? Check out the FAQ!

Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

asked 9 years ago

MLainz gravatar image

Using interact

I want to visualize these functions in the complex plane:

fn(z)=exp(z)nk=0zkk!

I tried this code, but it gives me an error.

z,k = var('z,k')
@interact
    def _(n=(1..8)):
    complex_plot(exp(z)- sum(z^k/factorial(k), k, 0, n), (-5, 5), (-5, 5))

I am new to Sage (I previously used Mathematica). I wrote the code based on this example: http://wiki.sagemath.org/interact/ . How can I fix that?

click to hide/show revision 2
No.2 Revision

Using interact

I want to visualize these functions in the complex plane:

fn(z)=exp(z)nk=0zkk!

I tried this code, but it gives me an error.

z,k = var('z,k')
@interact
    def _(n=(1..8)):
    complex_plot(exp(z)- sum(z^k/factorial(k), k, 0, n), (-5, 5), (-5, 5))

I am new to Sage (I previously used Mathematica). I wrote the code based on this example: http://wiki.sagemath.org/interact/ . How can I fix that?

EDIT: I would also like to know why doesn't this work either

def myPlot(n):
   complex_plot(exp(z)- sum(z^k/factorial(k), k, 0, n), (-5, 5), (-5, 5))

Then I type myPlot(2) in the notebook, but I get nothing. However, if I type:

complex_plot(exp(z)- sum(z^k/factorial(k), k, 0, 2), (-5, 5), (-5, 5))

I get the correct plot.

click to hide/show revision 3
No.3 Revision

Using interact

I want to visualize these functions in the complex plane:

fn(z)=exp(z)nk=0zkk!

I tried this code, but it gives me an error.

z,k = var('z,k')
@interact
    def _(n=(1..8)):
    complex_plot(exp(z)- sum(z^k/factorial(k), k, 0, n), (-5, 5), (-5, 5))

I am new to Sage (I previously used Mathematica). I wrote the code based on this example: http://wiki.sagemath.org/interact/ . How can I fix that?

EDIT: I would also like to know why doesn't this work either

def myPlot(n):
   complex_plot(exp(z)- sum(z^k/factorial(k), k, 0, n), (-5, 5), (-5, 5))

Then I type myPlot(2) in the notebook, but I get nothing. However, if I type:

complex_plot(exp(z)- sum(z^k/factorial(k), k, 0, 2), (-5, 5), (-5, 5))

I get the correct plot.

EDIT 2:

I tried

myPlot = lambda n: complex_plot(exp(z)- sum(z^k/factorial(k), k, 0, n), (-5, 5), (-5, 5))

And now I can evaluate it. However, I still can't use @Interact.

This doesn't make sense to me.