HP Forums
Complex plotting question - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Complex plotting question (/thread-10427.html)



Complex plotting question - John Keith - 04-01-2018 10:22 PM

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


RE: Complex plotting question - Eddie W. Shore - 04-02-2018 03:18 AM

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


RE: Complex plotting question - John Keith - 04-02-2018 03:03 PM

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.


RE: Complex plotting question - Tim Wessman - 04-02-2018 04:42 PM

Recomputing twice isn't particularly a concern here, since it is actually going to be evaluated thousands or possibly tens of thousands of times. Smile

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.


RE: Complex plotting question - John Keith - 04-02-2018 08:52 PM

(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! Smile