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

Units won't cancel with Solver

Newbie

Units won't cancel with Solver

I'm setting up an equation to solve for a final temperature, and inserting the units makes Solver fail. From the way it's acting, it appears it's treating the symbol 'K" as a variable rather than Kelvin temperature. For example, if I write xK, it doesn't insert the tiny dot that means it's recognized the "K" as a Kelvin temperature. Typing x*K will insert a multiplication sign, but Solver still produces gibberish.

Take all the units out, and it works fine. But I'd much, much rather have MathCad track the units as an additional check. If possible. I can't find anything in the manual or online help that even comes close to addressing this.

File attached as MathCad 12 .mcd file, although I'm using MathCad 14.

Jeff Corkern

Tags (1)
15 REPLIES 15

Re: Units won't cancel with Solver

For example, if I write xK, it doesn't insert the tiny dot that means it's recognized the "K" as a Kelvin temperature.

Are you sure it doesn't think you've created a single variable called "xK"?

Also, when in doubt, use the Insert>Units menu.

You would be surprised what happens when Mathcad doesn't know you mean for "g" to be grams, not 9.8 m/sec^2.

Re: Units won't cancel with Solver

There are several errors in your worksheet.

The heats of formation need to be cal/mol or similar.

The heat of reaction in the equation you are solving should have a negative sign to make the right hand side positive.

There is not a unit "grams", only "gm" or "kg".

Re: Units won't cancel with Solver

Tried Insert Unit. Didn't work. My variable x went completely away, to be replaced by K.

I had a user-defined unit "gram" in the worksheet I cut this from. "gm" kept causing problems, so I re-defined a new unit.

Yeah, it should be cal/mol and the sign should be different.

But after doing all that, I still have the original problem.

Re: Units won't cancel with Solver

Jeff,

Try using the symbolics>solve>variable and selecting x. That's what I did. If that doesn't work, please attach the modified worksheet.

Harvey

Re: Units won't cancel with Solver

On my version, it's "Symbolics, Variable,Solve" and somehow it just won't take it. I tried "solve, x" and it's still not recognizing the degree units

File attached as MathCad 12 .cmd file.

Jeff Corkern

Re: Units won't cancel with Solver

Here (x-298)K x is unitless

I think the correct solution ison this way:

Chem.png

Re: Units won't cancel with Solver

Is this what you need?

Regards

Andy

Re: Units won't cancel with Solver

What was my mistake?

I have tried that before and gotten gibberish.

I copied and pasted your entire page, put it in mine, and it worked.

The only difference I can see between the two is their alignment.

How was it aligned incorrectly?

Hmm, further examination shows you removed where I used the equals sign and forced it to calculate to a number for the delta-H of reaction. Forcing your worksheet to do the sames makes the Solve part crash on your worksheet.

Howsomever, removing the equals sign from my delta-H calculation still doesn't make it calculate correctly on my worksheet.

Re: Units won't cancel with Solver

The major change was from (x-298)K to (x-298K) ; the solve function is calculating the 'x' in K so the constant needs to be dimensioned accordingly.

Regards

Andy