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

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

Trying to find partial pressure using partition functions

msu12181
1-Newbie

Trying to find partial pressure using partition functions

Hi everyone,

I am new to the Mathad world when it comes to the nonlinear solvers for system of equations. I would appreciate any help that I can get

I am trying to find partial pressures for an equilibrium equation of state model. I am running into trouble as to how I can get each of the partial pressures as a function of my temperature. I am attaching the Mathcad file so that you can see what I mean. I have doubled check my stuff but I am unsure of how to proceed. It keeps saying that "initial guess must consist of numbers and matrices".

Anybody care to get me out of my mess I have created?

Thanks,

Addison

1 ACCEPTED SOLUTION

Accepted Solutions
RichardJ
19-Tanzanite
(To:msu12181)

You can't take the derivative w.r.t. T because it's not a function of T. To make it a function of T also requires some changes earlier in the worksheet. See the highlighted regions.

As an aside, if you have to multiply by m^3 to be able t take the log, that might indicate a problem. It depends on where the formula comes from. If it is an empirical formula, this can happen. If it is a formula derived from the physics, it will never happen. If it's derived from the physics and the log of the quantity has any physical meaning then the quantity must be dimensionless to begin with.

View solution in original post

13 REPLIES 13

The attached might help a little, but doesn't solve all your problems!

Alan

RichardJ
19-Tanzanite
(To:msu12181)

You need to turn the solve block into a function.

I appreciate the help in correcting the mess I created. I wish there is was a way I could get all the partial pressures to calculate out of the entire temp range instead of limiting it to the first couple.

Thanks again for all your help.

Addison

Dear Addison!

May be this Mathcad WebSheet (The Ionization Constant of H2O) will be interesting to you:

http://twt.mpei.ac.ru/MCS/Worksheets/WSP/KwTPo.xmcd

RichardJ
19-Tanzanite
(To:msu12181)

If a valid solution exists for those temperatures then you will be able to find it by changing the guess values so that they are closer to the solution.

Instead of using the Find(Partial Pressures), I ended up using the minerr function which punched the expected number out in no time.

Thanks again.

RichardJ
19-Tanzanite
(To:msu12181)

Minerr will give you an answer, but that answer may not satisfy your equations. Minerr will just minimize the error in the equations, and the minimized error could still be very large.

Richard Jackson wrote:

Minerr will give you an answer, but that answer may not satisfy your equations. Minerr will just minimize the error in the equations, and the minimized error could still be very large.

That's for sure! see the attached.

Alan

Ok guys I am running into something else here that is bugging me. This is something that is probably going to make me feel ignorant when I find out a solution. I am trying to take the derivative to figure out my energy but it keeps saying that the value must be a scalar. I am attaching the sheet.

RichardJ
19-Tanzanite
(To:msu12181)

You can't take the derivative w.r.t. T because it's not a function of T. To make it a function of T also requires some changes earlier in the worksheet. See the highlighted regions.

As an aside, if you have to multiply by m^3 to be able t take the log, that might indicate a problem. It depends on where the formula comes from. If it is an empirical formula, this can happen. If it is a formula derived from the physics, it will never happen. If it's derived from the physics and the log of the quantity has any physical meaning then the quantity must be dimensionless to begin with.

Thanks. I knew it had to be something really simple. And yes it was a vectorized result.

Ok. I promise this is the last thing I am going to ask regarding this Mathcad sheet. Probably another case of not having a function defined in T.

RichardJ
19-Tanzanite
(To:msu12181)

Ok. I promise this is the last thing I am going to ask regarding this Mathcad sheet.

You should be careful about making promises you may regret

Probably another case of not having a function defined in T.

Yes. The problem is in the definition of h(T). You have defined it in such a way that it will return a vector of temperatures even with a scalar argument (and will fail completely if you give it a vector of temperatures that is of different length to the original vector). That is because cH2O, cH2, etc are vectors. They need to be functions of T. The derivative operator doesn't know what to do with a function that takes a scalar and returns a vector (what's the gradient when you have multiple h for each T?).

You are running into these problems because you are carrying your results through the worksheet as a series of vectors. What you really need to do, although it's a lot of work. is to change everything that depends on T to a function of T. Then create a vector (with a different name of course) when needed.

Top Tags