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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Solve equation with variables of different units

BPP
7-Bedrock
7-Bedrock

Solve equation with variables of different units

I find myself trying to solve a set of equations, which are a function of two variables (P2 and D), with different units (psi and pulg), whose values I intend to find out.

How I can deal with this problem?

Thank in advance

1 ACCEPTED SOLUTION

Accepted Solutions
Werner_E
24-Ruby V
(To:BPP)

Here are two different approaches.

View solution in original post

19 REPLIES 19
Werner_E
24-Ruby V
(To:BPP)

Bryan Pérez Pérez wrote:

I find myself trying to solve a set of equations, which are a function of two variables (P2 and D), with different units (psi and pulg), whose values I intend to find out.

How I can deal with this problem?

You deal with this problem exactly as you had done, but ...

... you haven't defined variable f

... you used function L.e with just one argument while ther should be two

... you have a unit mismatch in your first inequation (left side Re(D) is dimensionless, right side is in/psi) guess it should be P.2 instead of D on the RHS

... ???

BPP
7-Bedrock
7-Bedrock
(To:Werner_E)

IMAGEN.png

I made the correction of the inequality, but still can not solve the problem

Werner_E
24-Ruby V
(To:BPP)

Bryan Pérez Pérez wrote:

I made the correction of the inequality, but still can not solve the problem

There are still my other two points missing.

1) You used your own function L.e wrong in the second equation of the sove block (argument D is missing)

2) f is missing. You cant't expect it to be calculated from the first equation unless you

a) provide an explicit function f(D,P.2):= ... or

b) you include f in the list of variables Mathcad should solve for - then you have to provide a guess value

BPP
7-Bedrock
7-Bedrock
(To:Werner_E)

At last I found the mistake of Le (P2, D).

About provide explicit function f (P2, D), the truth could not do, because for the calculations the value of this variable is calculated by iteration of equation I use in the calculations.

Werner_E
24-Ruby V
(To:BPP)

Bryan Pérez Pérez wrote:

At last I found the mistake of Le (P2, D).

About provide explicit function f (P2, D), the truth could not do, because for the calculations the value of this variable is calculated by iteration of equation I use in the calculations.

Sure you can define a function f(D) which calculates the value of f for any given value of D!

As f is inside and outside of the logarithm you won't find an analytic function but will have to define a numerical one to do the job (a small solve block turned into a function of D).

Your solution will not be unique because you have one equation less than variables to solve for and two inequality constraints.

Another problem: If you insist on the second inequality you will not get a solution near your guess values. Try instead 1000 psi and 20 in.

BPP
7-Bedrock
7-Bedrock
(To:Werner_E)

The truth do not quite understand how, appreciate if you could give me an example on the attached sheet about defining f

BPP
7-Bedrock
7-Bedrock
(To:BPP)

My apologies for being so slow, I could finally get it, thanks for everything Werner

Werner_E
24-Ruby V
(To:BPP)

Here are two different approaches.

BPP
7-Bedrock
7-Bedrock
(To:Werner_E)

With your instructions, I managed to solve the problem, in the same way that your first approach.

Again, thank you very much Werner

BPP
7-Bedrock
7-Bedrock
(To:BPP)

I tried to combine this question, with the answer to the question "Extract values from tables" but I can not get it to work. Hope you can help me.

Attachment worksheet with what I intend to do.

Thanks in advance

Werner_E
24-Ruby V
(To:BPP)

Bryan Pérez Pérez wrote:

I tried to combine this question, with the answer to the question "Extract values from tables" but I can not get it to work. Hope you can help me.

Attachment worksheet with what I intend to do.

At first you would have to turn all values which are dependent on L, H1, H2 and Nc into functions of those four variables and similar with all values which are dependent on P1,Tp,eta and Qb. A single varaible may now be a function in up to eight arguments.

Then you would have to turn the solbe block into a function of those four variables, too. This would probably mean that you have to get rid of the units temporarily as the result of that solve block function would be a vector with elements of different dimensions which is not allowed in Mathcad. After solving you can add the units again.

The last part is a routine which loops through all of your components, extracts the L, H1 etc values, call the solve block function and collects the result in a nice table.

Looks you now know what to do the next time as this probably is not done in just a quarter of an hour, depending on whoch special cases you'd like to consider as well.

You wrote that you already tried something but I don't see any attempt in the sheet you attached.

Give it a try and if you got stuck its probably better to open a new question concentrating specifically on the error you may encounter and are not able to solve on your own.

athurin
4-Participant
(To:Werner_E)

Forgive me for hijacking the conversation, but ...

Werner Exinger wrote:

This would probably mean that you have to get rid of the units temporarily as the result of that solve block function would be a vector with elements of different dimensions which is not allowed in Mathcad.

Increadible ! A feature that is avalable in Prime and not in Mathcad !

This is so rare I just had to mention it ! (and I don't know if I should laugh or cry about it ...)

RichardJ
19-Tanzanite
(To:athurin)

Yes, it's one of the few features that we have been asking for for more than a decade that they have actually given us. I don't know what came over them.

Forgive them! They didn't mean it.

(In differential equations too!

BPP
7-Bedrock
7-Bedrock
(To:BPP)

When I finally get it, thank you very much for your advice Werner, served me pretty

Werner_E
24-Ruby V
(To:BPP)

Bryan Pérez Pérez wrote:

When I finally get it, thank you very much for your advice Werner, served me pretty

That means you already found a way to do what you asked for, right?

1.png

BPP
7-Bedrock
7-Bedrock
(To:Werner_E)

Yes; maybe it is not the best way, but so far it works well.

RESULTADO.png

Attached the file with my solution

Werner_E
24-Ruby V
(To:BPP)

Bryan Pérez Pérez wrote:

Yes; maybe it is not the best way, but so far it works well.

Attached the file with my solution

Looks good for me. And I was wrong when I suspected that you would have to get rid of the units. I forgot that we can put two single functions in a 2x1 vector as you did - thats the better solution.

BPP
7-Bedrock
7-Bedrock
(To:Werner_E)

I could solve my problem thanks to your advice, and based on what was learned from my previous questions, so thank you.

Top Tags