Complex plotting question
04-01-2018, 10:22 PM
Post: #1
 John Keith Senior Member Posts: 884 Joined: Dec 2013
Complex plotting question
When plotting the real and imaginary parts of a complex-valued function, the Prime draws one plot first, then the other. For example, in the Function app:

Code:
 F1(X)=RE(Zeta(0.5+X*i)) F2(X)=IM(Zeta(0.5+X*i))

This results in the function being evaluated twice for the same input values. Is there a way to plot both parts with one function or otherwise avoid the repetitive calculation?

Thanks,
John
04-02-2018, 03:18 AM
Post: #2
 Eddie W. Shore Senior Member Posts: 1,448 Joined: Dec 2013
RE: Complex plotting question
I don't know if you meant plotting the real values on the x axis and imaginary parts on the y axis?

If so, I would suggest using the Parametric App:

X1(T) = RE(function)
Y1(T) = IM(function)
Let T vary.

I am not sure how we can prevent two calculations when there are two calculations.

Eddie
04-02-2018, 03:03 PM
Post: #3
 John Keith Senior Member Posts: 884 Joined: Dec 2013
RE: Complex plotting question
No, I meant plotting both parts on the X axis, like this graph . The same equations in the Parametric app produce this other graph, both from the Riemann Zeta Function page on Wikipedia.

In the former case, the Function app has to recompute the same values twice, which is what I'm trying to avoid.
04-02-2018, 04:42 PM
Post: #4
 Tim Wessman Senior Member Posts: 2,290 Joined: Dec 2013
RE: Complex plotting question
Recomputing twice isn't particularly a concern here, since it is actually going to be evaluated thousands or possibly tens of thousands of times.

I don't think there is a way to avoid it. There is no "caching" of intermediate results like this across different defined functions because the complexity basically costs more then just calculating it. You'd have to lookup that the intermediate results matched, and do quite a bit of checking to make sure nothing funny was going on. I suspect it might end up being slower then just recalculating it.

Until we get some sort of a complex support in the plotter, you'll need to split it like this to do what you want I believe.

TW

Although I work for HP, the views and opinions I post here are my own.
04-02-2018, 08:52 PM
Post: #5
 John Keith Senior Member Posts: 884 Joined: Dec 2013
RE: Complex plotting question
(04-02-2018 04:42 PM)Tim Wessman Wrote:  Until we get some sort of a complex support in the plotter ...

That would be excellent!
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)