The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » sci.math.* » sci.math.symbolic

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: plotting a real-valued function but with imaginary errors
Replies: 5   Last Post: Aug 13, 2011 6:55 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Richard Fateman

Posts: 1,539
Registered: 12/7/04
plotting a real-valued function but with imaginary errors
Posted: Aug 6, 2011 11:56 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

If you are interested in seeing a display of y=f(x), over a real
interval 0<=x<=10, say, and where f is real-valued, finite, continuous,
etc. on that interval, there are many programs that are available to help.

What if f is real-valued (etc.) but the program that you use to compute
f has some round-off error that results in small imaginary parts? How
might you deal with this as a policy in a plotting program?

Some possibilities that come to (my) mind:

1. Instead of plotting f(x), plot realpart(f(x)), perhaps making some
kind of warning noise. This assumes imagpart(f(x)) is smaller than some
ignorable relative quantity compared to realpart. (difficulty: what if
realpart is small too???).
1b. (Same as 1 except no warning)

2. Leave blank spots on the display where the values of f(x) are not
purely real.
2b. (Same as 2 except issue warnings)



This should only be an issue if f(x) is computed by some formula that
you have concocted.

If f(x) is a good library function f:Real->Real, it should not product
results with non-zero imaginary components.

This problem came up in plotting, in Mathematica 7, this function:

JacobiSN[x,3] which is real for 3<x<5, yet a plot of it shows a gap
around 4.

If you have Mathematica available, you can see the result from
executing this:

Plot[{Re[JacobiSN[u, 3]], JacobiSN[u, 3]}, {u, 3, 5}, PlotStyle ->
{Orange, Thick}]

In my view the program computing JacobiSN should not be returning
complex values for real arguments, ever.

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.