cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Math equation problem of finding too many different answer,

J_power
10-Marble

Math equation problem of finding too many different answer,

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.

Jason_power_0-1662390872988.png

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?

Jason_power_1-1662390913615.png

 

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:J_power)

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:

Werner_E_0-1662394010260.png

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.

 

View solution in original post

6 REPLIES 6
Werner_E
25-Diamond I
(To:J_power)

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:

Werner_E_0-1662394010260.png

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?

 

 

Werner_E
25-Diamond I
(To:J_power)


 

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)

LucMeekes
23-Emerald III
(To:J_power)

No need to worry.

Know that you (can) have an expression for the root you are looking for:

LucMeekes_0-1662454409663.png

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:

LucMeekes_1-1662454461357.png

Check:

LucMeekes_2-1662454492250.png

OK. Now you can supply an array of values for Q (or k) to calculate the results:

LucMeekes_3-1662454887216.png

(Note you have to vectorise the expression).

And you can plot it:

LucMeekes_4-1662454933738.png

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.

LucMeekes
23-Emerald III
(To:J_power)

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

Announcements

Top Tags