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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

3-Visitor

## 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.

1 ACCEPTED SOLUTION

Accepted Solutions
24-Ruby V
(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.

MC15 worksheet attached

4 REPLIES 4
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

24-Ruby V
(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.

MC15 worksheet attached

3-Visitor
(To:Werner_E)

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)?

24-Ruby V
(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