Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
From this topic,
https://community.ptc.com/t5/Mathcad/How-to-only-get-one-value-from-the-answer/m-p/821656#M202449
I know how to find the real answer from the equation, but I have other questions.
I have a fours curve in this figure, and if I want to find this fours curve's peak position, I need to use the below equation. but if I have 100 curves I need to type 100 times, is there any efficient way I could do it quickly?
Solved! Go to Solution.
I already made one or two suggestions for a function f.center(Q,k) in the other two threads.
My favorite still is the numerical approach using the "root" function:
It looks like the peaks for k=6 never go beyond x=1, no matter what the value of Q might be. So we possibly could replace the 1000 in the "root" command by a 1 or 2.
BTW, the plotting of the locus curve of all peaks was done inefficient by me because the function f.center is called twice for every point plotted. It would be less time consuming to use precalculated vectors for plotting.
I already made one or two suggestions for a function f.center(Q,k) in the other two threads.
My favorite still is the numerical approach using the "root" function:
It looks like the peaks for k=6 never go beyond x=1, no matter what the value of Q might be. So we possibly could replace the 1000 in the "root" command by a 1 or 2.
BTW, the plotting of the locus curve of all peaks was done inefficient by me because the function f.center is called twice for every point plotted. It would be less time consuming to use precalculated vectors for plotting.
Hi @Werner_E ,
It seems that using the root command is the best way to draw the figure that I want. Thanks.
May I know why you said "plotting of the locus curve of all peaks was done inefficient ?"
Do you mean the yellow line?
May I know why you said "plotting of the locus curve of all peaks was done inefficient ?"
Do you mean the yellow line?
Yes. This is the curve, all peaks lie on (for k=6 and variable Q)
No need to worry.
Know that you (can) have an expression for the root you are looking for:
Gives a symbolic expression that is probably too big for Mathcad 15 to show, but you can still use it, to get the value of x in terms of Q and k:
Check:
OK. Now you can supply an array of values for Q (or k) to calculate the results:
(Note you have to vectorise the expression).
And you can plot it:
Success!
Luc
Hi @LucMeekes ,
Thanks.
May I know why you need to use sqrt() and ORIGIN in the equation?
because you said that using the root to solve it.
As shown in the other thread (https://community.ptc.com/t5/Mathcad/How-to-only-get-one-value-from-the-answer/m-p/821532#M202423) I used a substitution: y=x^2. That gives 3 possible values for y (instead of 6 for x) through the function K2'y(Q,k). Since the first result is positive, that's the one you (apparently) need. And the first element of an array is indexed with ORIGIN.
I don't use the root() function, but take the square root, sqrt() if you will, to go from y back to x.
Success!
Luc