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.Tue, 22 Oct 2019 16:26:20 +0200abs and plot problemshttps://ask.sagemath.org/question/48468/abs-and-plot-problems/Hi there.
I am encountering problems trying to plot some functions.
The following example shows how I am able to plot the modulus of a simple function using my own modulus function, but it fails using abs(). Which is really weird.
_ = var('a,x')
MODULUS(x) = sqrt(real(x)^2 + imag(x)^2)
Hmod = MODULUS(a*x + i*x^2)
Habs = abs(a*x + i*x^2)
plot([Hmod(a=n) for n in [1..5]], (x,0, 2))
plot([Habs(a=n) for n in [1..5]], (x,0, 2))
Hmod can be plotted, while Habs will return "TypeError: unable to coerce to a real number".
Anyone can help on that? I have seriously more complicated cases that I seem to be unable to plot because of this very problem.
Thanks a lot.cedrik0sTue, 22 Oct 2019 16:26:20 +0200https://ask.sagemath.org/question/48468/