Post Reply 
Complex plotting question
04-01-2018, 10:22 PM
Post: #1
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
Find all posts by this user
Quote this message in a reply
04-02-2018, 03:18 AM
Post: #2
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
Visit this user's website Find all posts by this user
Quote this message in a reply
04-02-2018, 03:03 PM
Post: #3
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.
Find all posts by this user
Quote this message in a reply
04-02-2018, 04:42 PM
Post: #4
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. 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.

TW

Although I work for HP, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
04-02-2018, 08:52 PM
Post: #5
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! Smile
Find all posts by this user
Quote this message in a reply
Post Reply 




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