Ask Your Question

jk's profile - activity

2016-05-12 21:17:55 +0100 received badge  Famous Question (source)
2013-10-03 21:01:46 +0100 received badge  Notable Question (source)
2013-01-10 11:20:16 +0100 received badge  Popular Question (source)
2012-02-02 19:23:45 +0100 received badge  Nice Answer (source)
2012-02-01 16:39:10 +0100 received badge  Student (source)
2011-10-20 12:12:19 +0100 received badge  Scholar (source)
2011-10-20 12:12:19 +0100 marked best answer Fast numerical plot command that always works?

I would probably do it like this:

C = -I*sqrt(pi)*x*e^(-1/4*x^2)
plot(f, (-10,10))
2011-10-20 12:12:07 +0100 commented answer Fast numerical plot command that always works?

Thank You @Jason Grout. This methods works, but only if `domain=CC` is specified explicitly. Mind to explain?

2011-10-18 19:44:36 +0100 commented question Fast numerical plot command that always works?

@Jason Grout, I update the question with an example and a link to a public worksheet. In this simple example, simplify() would solve the issue, but on more sophisticated expressions simplify will fail.

2011-10-18 19:40:24 +0100 received badge  Editor (source)
2011-10-17 14:56:26 +0100 asked a question Fast numerical plot command that always works?

I typically encounter expressions of the type

 C = -I*sqrt(pi)*x*e^(-1/4*x^2)
 Abs = abs(C)

Sage's built-in plot commands fails:

verbose 0 (4101:, generate_plot_points) WARNING: When plotting,
failed to evaluate function at 200 points.
verbose 0 (4101:, generate_plot_points) Last error message:
'unable to simplify to float approximation'

We can evaluate the expression numerically:

X = map(lambda x: x/10, range(-100,100))
Y = map(lambda xx: Abs.subs(x=xx).n(), X)
Yreal = map(real, Y)
Yimag = map(imag, Y)
list_plot(zip(X,Yreal)) + list_plot(zip(X,Yimag),color='red')

This works, but looks like a dirty workaround. Should I use numpy arrays and fast_callable? Or use fast_callable() without numpy?

Here is an example worksheet.

2011-10-17 14:43:11 +0100 answered a question HTTPS for Sage Webserver?

The documentation has an example, which does exactly what you want:

  • Sage Notebook server
  • No accounts for strangers
  1. I want to run the Sage notebook server on a remote machine and be the only person allowed to log in. Type:

    notebook(interface='', secure=True)

2011-10-17 13:57:28 +0100 commented answer Using symbolic expressions with numpy arrays

First, I agree with @Xaver that some more end-user accessible documentation would be very helpful. Google only found [this](, which does not appear to be a good starting point. Second, I'm not sure, whether this is the solution to OP's question. $f(x,y,z)$ is a function of three independent variables, so the general numeric result should be a $NxNxN$ matrix.

2011-01-06 11:41:23 +0100 received badge  Teacher (source)
2011-01-05 18:58:24 +0100 received badge  Supporter (source)
2011-01-05 18:58:06 +0100 answered a question Plotting question

'unable to simplify to float approximation'

Came here because I have a similar problem

Apparently the plotting command provided by Sage evaluate expressions by coercing to float, i.e. plot calls


This fails on your expression because it's too complicated.

Can someone explain why Sage doesn't evaluate expressions numerically when plotting? What would be a straightforward why to do this?