Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
I have attached what I have so far. At the bottom I have come to the point where I want to solve for x with a given Ka. I am stuck on this one.
Solved! Go to Solution.
As for the check: Both solutions pass, but there is some numeric roundoff for the positive one. Not surprising if you consider the coefficients of your quadratic equations are in the range of 10^12, 10^13 and you provide just 12 or 13 decimals of the constant in the denominator.
Generally numeric evaluation (as opposed to symbolic one) is limited to 16-17 decimals anyway.
Like the attached using a simple Given/Find solve block?
Not quite, I am looking to either solve symbolically for x= something in terms of Ka, or for actual answer of x. The last two equations on your page get off track somehow. I also find it hard to believe that x is a negative number. I don't think it is solving correctly.
The formula does return a positive and negative value for x.
Attached is a symbolic solution which returns the same answer as Werner.
Note I have remove the empirical unit handling.
Something must be off though, because when I type the answer for x back into the original equation, it does not return with the correct value of Ka.
edit: I'm not sure if I was using the correct notation originally. The bold equal sign may be incorrectly used in this case.
Im really not quite sure what is going on in that sheet. I am a beginner and I think this is probably a bit easier than what that looks like. Here is what it can really simplify down to. The only two variables are Ka and x, the other things are just units. I want to solve for x.
Its basically a quadratic equation you want to solve. So there are two solution - given the value of Ka you supplied, one solution for x is negative around -10^13, the other is positive (around 0.666).
I used the symbolic solve and because I assumed you would be interested in the positive solution, I used the command assume, x>0 to omit the negative solution. If you delete this assume statement, you get both solutions in a 2x1 vector - give it try.
I also used the variable M in the equation instead of the copied value - hope thats what you intended.
In fact I first tried to use a solve block like Mike has done, but I wasn't able to find a guess value which would yield the positive solution.
There is a big drawback in using the symbolic solver - it doesn't know anything about units and sees m, L and mol as unknown variables. Its able to cancel mol, but not m^3 and L. Thats why I told the symbolic solver to substitute L by 10^-3 m^3. That way all units can be cancelled and we get the scalar solution as expected.
As you demanded also a symbolic solution, you either have to solve before you define Ka or make Ka unknown to the symbolics by writing Ka:=Ka.
Here you are - the symbolic solution, followed by both solution in their numeric representation:
As for the check: Both solutions pass, but there is some numeric roundoff for the positive one. Not surprising if you consider the coefficients of your quadratic equations are in the range of 10^12, 10^13 and you provide just 12 or 13 decimals of the constant in the denominator.
Generally numeric evaluation (as opposed to symbolic one) is limited to 16-17 decimals anyway.
Ok, thank you for your help. I think I get it now.
Great explanation Werner
Mike Armstrong wrote:
Great explanation Werner
Maybe, but at least partially wrong. The number of decimals provided for the constant has nothing to do with the roundoff errors.
And strange enough - forcing the symbolics in exact mode by providing the constant as fraction of integers makes it even worse - at least the numeric eval.
Also note the difference between the numeric and symbolic evaluation of Y.
Not good at all.
The calculations simply are too close to Mathcads numerics precision limits.