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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Error in solving equation

BPP
8-Gravel
8-Gravel

Error in solving equation

Hello everyone

I need to find the value of a variable (Dev) per iteration, assigning an initial value, but I get error and truth do not know why.

FIGURA.png

Hope you can help

ACCEPTED SOLUTION

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

You could do as I already wrote and solve for all three unknowns, but I thought it would be a better idea to turn Re and v.1 into functions of D.ev which they obviously are.

Now there are only three inequalities for D.ev left and not a single equations. So you have a range of valid values for D.ev and Find will give you the smallest one (3.069 in). If you chose different(higher) guess values you get different results.

In your second solve block there is a unit mismatch.

1.png

View solution in original post

13 REPLIES 13
Werner_E
25-Diamond I
(To:BPP)

Attach your file, not just a picture.

It looks to me that v.1 and Re are unknown, too, and so you will have to search for all three unknowns and provide guesses for all of them. But you only have two equations!??

BPP
8-Gravel
8-Gravel
(To:Werner_E)

Sorry, This is the file

Werner_E
25-Diamond I
(To:BPP)

You could do as I already wrote and solve for all three unknowns, but I thought it would be a better idea to turn Re and v.1 into functions of D.ev which they obviously are.

Now there are only three inequalities for D.ev left and not a single equations. So you have a range of valid values for D.ev and Find will give you the smallest one (3.069 in). If you chose different(higher) guess values you get different results.

In your second solve block there is a unit mismatch.

1.png

BPP
8-Gravel
8-Gravel
(To:BPP)

Thanks Werner. One last question, as I can do to calculate "Dev" for each value in the case of multiple input values.

FIGURA1.png

Thanks in advance

Werner_E
25-Diamond I
(To:BPP)

It may work if you vectorize ALL calculations dealing with those vectors.

The other (and in my opinion better) way is to make v1, Re functions of Q, p1, etc and turn the solve block into a function of all those variables you like to change. Then call that function with your vectors as arguments.

BPP
8-Gravel
8-Gravel
(To:Werner_E)

Vectorized functions not work, but the second way, worked perfectly.

Again, many thanks werner

Werner_E
25-Diamond I
(To:BPP)

Bryan Pérez Pérez wrote:

Vectorized functions not work, but the second way, worked perfectly.

Again, many thanks werner

Both ways work and you don't even need to vectorize for the first approach. You only have to set up the guess as a vector.

1.png

------------------------------------------------------------------------------------------------

2.png

BPP
8-Gravel
8-Gravel
(To:Werner_E)

Werner Exinger wrote:

You only have to set up the guess as a vector.

I didn't know you could do that

As for the results. It possible calculate the minimum and maximum values (Dev_min and Dev_max) satisfying these three equations?

Werner_E
25-Diamond I
(To:BPP)

As for the results. It possible calculate the minimum and maximum values (Dev_min and Dev_max) satisfying these three equations?

Not with Find(). It seems you get the lowest value if you provide a very small guess, but if you provide a very high guess value, you don't get the upper limit of your range - at least not reliably.

You can use a dummy function f(x):=x and use Minimize(f,D.ev) instead of find to get the minimum valeu. But for reasons unknown to me maximize() failed.

You can add D.ev<0 as constraint and end the solve block with minerr(D.ev) to get the minimium. If you change the constraint to D.ev > 100 in you should get the maximum value.

But I guess because your inequalities are simple enough the most obvious way to deal with the whole problem is to directly solve the inequalities to get the range of allowed values for D.ev:

1.png

BPP
8-Gravel
8-Gravel
(To:BPP)

Hello everyone

Like the startup problem, trying to solve an equation me an error occurs, I hope you can help me.

Attached worksheet with the problem

Werner_E
25-Diamond I
(To:BPP)

Right click on the error and chose "Trace Error" and then "First" to get more information why the solve block failed.

1.png

In your case you typed "e^S" instead of "e^S(P.1)".

BPP
8-Gravel
8-Gravel
(To:Werner_E)

I did not know the tool you used (Trace error), thank you very much Werner

Werner_E
25-Diamond I
(To:BPP)

Error messages, especialy in solve blocks leave a lot to be desired. The only error message a solve block ever will throw is the "unknown variable" message, no matter what the real cause may be. Using "trace error" often (but not always) can help to track down the real reason for the solve block failing.

Announcements

Top Tags