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

GROUPS:
 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.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. 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!JEdit: 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.
1 year ago
9 Replies
 When Solve wants rational numbers it means integers or fractions.
1 year 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...
1 year ago
 Try thisWA Plotfollowed byWA FindRoot
1 year 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!
1 year ago
 Marco Thiel 2 Votes 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
1 year ago
 Thank you Marco!The working Precision I will try, and the Rationalize ] function seems interesting, too.The problem is, that you used my first 'mistaken' function, not the 'revised' one. If I correct my error and try your formula on the cloud I get terminated because of computing time. (Sometimes it's the Wolfram Engine that's been [terminated, too. ;) - I assume that the run time extension doesn't work here neither, because it said something about buying a new plan.I just tried my "latest" attempt on the cloud (which is nice, tank you for that, too. I didn't know about that), which produced a "The Wolfram Engine has been terminated because the evaluation time limit was reached" message, too.Some things in your formula I don't understand (and don't find anything in the Mathematica built in help about), so if you could elaborate, that'd be great. What does sols= or /. sols do? Why do you rationalize the coefficients? They should not be the problem, I'd assume that the logarithms are. 0.059 is rational either way, isn't it? The two numerical zeros (which I got when I tried what you did), what do they mean? I assume that the two solutions are not the same, but numerically not distinguishable, or did I get that wrong? - That mean the sols would have something to do with that. Thank you again for your time!
 Ok, after doing some try and error I tried to find out what the problem was rationally. It became pretty obvious that Solve[ ] has a problem with sums of multiple logarithms in the form of aLog[b-cx]. As I had noticed that in my plot I always got some kind of complex part I tried expanding all the logarithms (by hand, not too difficult) and placing a Re[ ] in front of every logarithm of that form. Wolfram Alpha refused to compute that (runtime again), so I tried it on my laptop, and I didn't run into my usual "inexact coefficients" error, Yay!Well, my computer is calculating for hours now (app. 50% (workload/usage) at 2.6 GHz). This reminds me that my theoretical chemistry lecturer liked to say (paraphrased):> Exponential functions are a bitch to calculate. That's why we approximate them with the Taylor-Series.Well, that's what I'm going to try next. Here's the function I'm using right now: NSolve/Solve/Reduce[0 == 1.76 + 0.0128117 (Log[10, 65] - Re[Log[10, (30.9 - 1.5 X)] ]) - 0.00426911 ( Log[10, 369720589101871337890625 X^2] - (14 Re[ Log[10, 500000001/10000000 - 7 X] ] + Re[ Log[10, 4.1 - 0.5 X] ] ) ), X] Could anyone tell me if I can simply cut off the imaginary part? As I want a rational (real) solution, I'd assume so. Or does this change the result I'll get (significantly)?I'll also insert Marco's WorkingPrecision in the Taylor-Series approach.Edit:Ok, I did that. It lead me to a solution, but not a good one. The term that is making problems is: Log[50-7X] That simply makes this equasion unsolvable in $/R$. This led me back to my beginning, And I see the problem, it's my formula again. Right now I don't really know how to solve it, so I can't put it into Mathematica. I'll have to rethink. Thank you all for your help, I think I learnd something while trying to get this calculation to work.Have a nice day!J
 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 thenand 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.
 Hello Bill.Yes, that might have been an option, you are right. I'm sorry. But I was under the impression, that asking for a specific problem was better than posting my general problem and expecting someone to solve it for me. And I really did hope to learn enough to solve it myself, as I'm probably the only one who cares if I solve this (or if it is solved at all).And I just got almost exactly the same solution in a completely different way. Which kinda impresses me, because I thought my original equation was not precise enough to mimic my Problem. Thank you for your effort!What I did in the end was: Clear[a, d] a[x_] = 1.76 + (26691 Log[1/60 (30.9 - 1.5 x)])/(6.25*10^7) - (2135281 Log[x^2/ ( 3600 (Sqrt[10^-14 + 1/4 (-(5/6) + (7 x)/60)^2] + 1/2 (5/6 - (7 x)/60))^14 (4.1 - 0.5 x))] ) / (5*10^8) d[x_] = D[a[x], x] FindMinimum[{d[x], 1 < x < 8}, {x, 7.14}] Plot[a[x], {x, 0.01, 8}, PlotRange -> {0.2, 2}] Clear[a, d] I got a new equation and found it's inflection point. I did find the root, too, but I preferred this one.I know it's a bit late in the end, but I could explain my original problem:The reaction of Potassium Dichromate with Oxalic Acid and Potassium Oxalate to Carbon Dioxide and Chrome(III) is highly influenced by the concentration of Protons (pH), although there are different possibilities which of the reagents (/educts) is the limiting factor. I had used 4.1 mmol , 25 mmol and 5.9 mmol . My Volume had been 60 mL. With the Nernst-Equation you can calculate the redox-potential of a redoxreaction and therefor whether or not a reaction takes place. After listing a lot of factors I wanted to disregard or assumptions I wanted (had) to make I set up an equation and tried to solve it with Mathematica. Formulas and my final computable Formula:And thanks to your help, too, I am not only able to take a very good educated guess (only guessing because of all of those assumptions) when the reaction stopped, I am able to show that it indeed is because of the pH. (As a nice side-effect I also justified some of my assumptions.) The following shows a plot of the pH and the redoxpotential.I also understand now why the root you provided (have I thanked you for that yet?) is the same to my result. My original approach was only able run to a pH of 7, the pH of at my inflection point is 7.I wanted to tell you that I am very thankful for your patience with me. And for helping me learn a great deal today.Sincerely Yours,Jonas