Group Abstract Group Abstract

Message Boards Message Boards

Solve Redox equation with inexact coefficients, Solve[Log10[f(x)]]?

Posted 9 years ago

Hi,

My Problem is probably pretty straight forward. I have an equation I cannot solve by hand, so I asked WA. My initial attempt (after getting rid of some errors of mine) was the following:

Solve[0 ==1.33- (0,059/6)*Log10[ ((X/60)^2)/(((25-7*X+10^(-7))/60)^14*0.5*X)]-(-0.43-0.0295*Log10[1/((25+5.9-1.5*X)/60)]),X]

Which produced the error-message:

Solve::inex: Solve was unable to solve the system with inexact coefficients or the system obtained by direct rationalization of inexact numbers present in the system. Since many of the methods used by Solve require exact input, providing Solve with an exact version of the system may help.

As ´0,059/6` is real and not rational I exchanged it with 0.00983 which should be sufficiently precise for my purposes. Tried it again, but nothing changed. When using the following in order to have that request computed by WA directly I got the value 3.57143 which I was mildly happy about, as it was a solution although I didn't quite like the result. (I had expected something in the magnitude of 5.)

 ==Solve[0 ==1.33- 0.00983*Log10[ ((X/60)^2)/(((25-7*X+10^(-7))/60)^14*0.5*X)]-(-0.43-0.0295*Log10[1/((25+5.9-1.5*X)/60)]),X]

Same formula as a picture for better overview
Same formula as a picture for better overview.

My Joy was further diminished when I noticed I made a mistake in my formula. This should be the right time to explain what I was originally trying to calculate.
As I am a chemist I wanted to solve a problem concerning a redox reaction. An amount of Oxalat, acid and Dichromate are solved in water, the volume of the solution is 60 mL. I did that and wondered why I didn't get more product (Potassiumchrome(III)oxalat). What exactly happened isn't really the point here, but this was the foundation of my equation.

Nernst equasion

After some simplifications and the substitution of different parameters as a function of X, which I defined as the amount of Cr(III) [mol] I got said formula. Well, I got the above formula, the correct formula should have been:

Solve[0==1.33-0.00983* Log10[((X/60)^2)/(((25-7*X+10^(-7))/60)^14*(   *(4.1-0.5*X)/60)*   )] -(-0.43-0.0295* Log10[1/((25+5.9-1.5*X)/60)]), X]    (the change is  *(4.1-0.5 X)/60)*)

This got the now familiar error-message "Solve::inex". Trying again to have that computed by WA led me to being told that the runtime of 30 seconds was exceeded:

WolframAlpha::timeout: The call to WolframAlpha[Solve[0 == 1.33 - 0.00983Log10[((X/60)^2)/(((25 - 7X + 10^(-7))/60)^14( (4.1 - 0.5X)/60))] - (-0.43 - 0.0295Log10[1/((25 + 5.9 - 1.5X)/60)]), X]] has exceeded 30.` seconds. Increasing the value of the TimeConstraint option may improve the result.

So I found out how to do that and tried:

==TimeConstrained[Solve[0==1.33-0.00983* Log10[((X/60)^2)/(((25-7*X+10^(-7))/60)^14*((4.1-0.5*X)/60))] -(-0.43-0.0295* Log10[1/((25+5.9-1.5*X)/60)]), X], 300]

FetchURL::httperr: The request to URL http://www4c.wolframalpha.com/api/v2/recalc.jsp?appid=XXX&id=XXX&uuid=None&mlicense=XXX&machineid=XXX&sig=XXX was not successful. The server returned the HTTP status code 403 ("Forbidden").
[I XXXed out the IDs. Don't know if they mean anything to any of you, but I prefer being cautious.]

Not really suprising that WA prohibits that, but well, worth a try. Next I tried out multiple versions of N[XXX, 5], which were all pretty useless not to say stupid of me. I played around with Solve[expr,X,Reals], which didn't lead to anything. After that I found a NSolve[], and well, a numerical solution would be perfectly fine with me, but it didn't work out. I was considering to split it up and get some expression for each logarithm. I wasn't able to do that, as for Solve[ ] I need an equation and I couldn't get my head around that. Simplify[ ] didn't yield anything.

And now I'm out of ideas... Is the equation even solvable? In my inexperienced opinion I'd say if I got a solution for the "wrong" equation, I should get one for the second one, too, as it isn't that much more complicated...

I'd be happy if some of you had an idea you could share with me, point out some mistakes of mine or help me in any other way. It buggs me not knowing why it doesn't work and probably even more not knowing how to fix it...

Thank you all in advance and have a nice day!

J

Edit: I've jet to get accustomed to the formatting and editing in this forum, eg. the §§-thingies. So please be patient with me if I didn't do it well. That's why I inserted the two formulas as pictures. In case I broke some code of conduct rules, please tell me I'll try better next time I'm around. If you need more information of any kind I'd be glad to provide them. Edit 2: Damn it, got rid of some typos.

POSTED BY: Jonas N.
9 Replies
Posted 9 years ago

I take your expression from your latest post

f = FullSimplify[176/100 + 128117/10^7 (Log[10, 65] - Re[Log[10, (309/10 - 15/10 X)]]) - 426911/10^8
   (Log[10, 369720589101871337890625 X^2]-(14 Re[Log[10, 500000001/10000000-7 X]]+Re[Log[10,41/10-5/10 X]]))]

and then

Plot[f, {X, 0, 10}, WorkingPrecision -> 20]

and then

the plot

and then in a fraction of a second

FindRoot[f == 0, {X, 7}, WorkingPrecision -> 20]

gives {X -> 7.1428571571087710129} a one warning about it likely not really being 20 digits of precision.

But I suspect those Re[] may be giving you something very different from what you are expecting to measure with an instrument in the lab.

Perhaps if you could retreat from all of the changes and little errors and revisions and patches and ways of trying to possibly make Mathematica happy, perhaps even well back before your first post here, and just explain in the simplest, clearest possible way what you are certain the original problem to solve really is then someone might be able to take a few minutes and see if they can find a way to quickly calculate a solution.

POSTED BY: Bill Simpson
Posted 9 years ago
POSTED BY: Jonas N.
Posted 9 years ago
POSTED BY: Jonas N.

Hi,

this here appears to work on WA. It does time out but you do see two (very similar) solutions. I would recommend though to use one of the free versions of the Wolfram Language in the cloud, such as the Wolfram Development Platform. There you can use standard Wolfram Language code:

sols=NSolve[0 == 1.33 - (0.059/6)*Log10[((X/60)^2)/(((25 - 7*X + 10^(-7))/60)^14*0.5*X)] - (-0.43 - 
0.0295*Log10[1/((25 + 5.9 - 1.5*X)/60)]), X, Reals, WorkingPrecision -> 30]

If you substitute that into the original equation it seems to work:

1.33 - (Rationalize[0.059]/6)*Log10[((X/60)^2)/(((25 - 7*X + 10^(-7))/60)^14*1/2*X)] - (-Rationalize[0.43] - 
Rationalize[0.0295]*Log10[1/((25 + Rationalize[5.9] - 3/2*X)/60)]) /. sols

Gives two "numerical zeros".

Cheers,

Marco

POSTED BY: Marco Thiel
Posted 9 years ago
POSTED BY: Jonas N.

When Solve wants rational numbers it means integers or fractions.

POSTED BY: Frank Kampas
Posted 9 years ago

Ok, thanks, now I at least understand why it wouldn't compute. Could you give me some kind of advice on how to get

Log10[(369720589101871337890625 X^2)/((500000001/10000000 - 7 X)^14 (4.1 - 0.5 X))]    

to be either? I'm assuming to get that to be an integer is pretty unrealistic. Is there a chance to get it to be a fraction? My initial idea was rounding that, but it failed. Probably because you can't round variables...

POSTED BY: Jonas N.
Posted 9 years ago

Try this

WA Plot

followed by

WA FindRoot

POSTED BY: Bill Simpson
Posted 9 years ago

Thank you Bill,

Yesterday evening I tried the Plot[ ], too, but sadly it didn't lead to a solution I was satisfied with...

Both, the find root and the plot give back the result 3.57[...], which was my original result. As I looked at the Formula noticed that it was using my original mistaken one and not the "revised" version.

Thanks for your effort!

POSTED BY: Jonas N.
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard