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

problem around solve blocks

SOLVED
MN_9927727
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

Re: problem around solve blocks

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

Re: problem around solve blocks

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

Re: problem around solve blocks

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

Re: problem around solve blocks

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

Re: problem around solve blocks


@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
Check out the latest
Mathcad Tip
"PTC Mathcad 15 / Prime 1-6 Update."