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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

problem around solve blocks

MN_9927727
3-Newcomer

problem around solve blocks

Hi,

 

I'm using Mathcad 15 and I'm having problem in using solve block. What I'm trying to get is to find the values of PM.guess that will satisfy the LF.sum=1.

 

Appreciate if you can let me know how to fix this.

 

Thanks.

ACCEPTED SOLUTION

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

What Luc suggested sure is the way you should do it, even though its not forbidden to place assignments and guess values after the "given" keyword.
What you had misunderstood is that all those assingments are calculated only once with the initial guess values of PM and are not subject for nay iteration.

That said you must turn all your calculations into functions of PM and then use them in the solve block.

Here is an example how to do it.

I am not sure if its a problem, but you provided only positive guess values while the solution values are all negative.

Werner_E_0-1620442382168.png

MC15 worksheet attached

 

View solution in original post

4 REPLIES 4
LucMeekes
23-Emerald III
(To:MN_9927727)

You should read the help info and study the examples of solve block usage.

There should be NO assignments between the Given and the Find. There can ONLY be constraints (those with a bold equals sign).

(You have a lot of assignments, those with :=   ).

The Guess values should be placed BEFORE the Given.

 

Success!
Luc

Werner_E
25-Diamond I
(To:MN_9927727)

What Luc suggested sure is the way you should do it, even though its not forbidden to place assignments and guess values after the "given" keyword.
What you had misunderstood is that all those assingments are calculated only once with the initial guess values of PM and are not subject for nay iteration.

That said you must turn all your calculations into functions of PM and then use them in the solve block.

Here is an example how to do it.

I am not sure if its a problem, but you provided only positive guess values while the solution values are all negative.

Werner_E_0-1620442382168.png

MC15 worksheet attached

 

Thanks Werner_E. This is what I needed. I am not too concern about the negative values of the solutions at this moment.
Just for my understanding, what's is the reason to use the local assignment ("tmp") when defining the LOG_LD(PM)?

Werner_E
25-Diamond I
(To:MN_9927727)


@MN_9927727 wrote:

Thanks Werner_E. This is what I needed. I am not too concern about the negative values of the solutions at this moment.
Just for my understanding, what's is the reason to use the local assignment ("tmp") when defining the LOG_LD(PM)?


The reason for this local assignment is because we cannot vectorize the calculation for LOG_LD as is was provided because that way we would also vectorize the interpolation. So this interpolation is called not vectorized in first place and then its result is used vectorized in the following calculation.

For similar reasons I did NOT vectorize the calculations for LD (and subsequently also for LF, which calls LD). Vectorizing those functions would yield wrong results in a nested array as data structure and so the solve block would fail.

Announcements

Top Tags