Message Boards Message Boards

Different numerical equation results between Mathematica and Wolfram|Alpha

Posted 1 year ago

Dear all,

The attachment is the file I edited to calculate the corresponding pressure of two gas sorption curves at the same uptake.
The first equation is "((0.213832x^1.58622)/(1 + 0.21405x^1.58622) + (0.0869386x^0.453591)/(1 + 0.00377x^0.453591)) = y", and the second is "((2.05986x^1.20192)/(1 + 1.76097x^1.20192) + (0.0031527x^1.09255)/(1 + 0.0041x^1.09255)) = y". Where x stands for the pressure (independent variable), and y stands for the uptake (dependent variable). In Notebook, I set p1 and p2 as the independent variables to distinguish the two equations.

I found the result in the output excel file contains some problems, see the following photo. enter image description here

I found some of the results corresponding to the second equation are complex numbers. I have checked an example on the website of WolframAlpha. I set y as 1, and then the equation is "((2.05986x^1.20192)/(1 + 1.76097x^1.20192) + (0.0031527x^1.09255)/(1 + 0.0041x^1.09255))=1", WolframAlpha told me that the answer is 2.59898. The screenshot of WolframAlpha is shown here:
enter image description here

I am confused that why there is anything wrong in my Notebook file. Why some of the results in the output excel file is correct but some of them look not normally? Both of my equation is Monotonic function and the range of the function is the full real number.

I hope some expert could have a look at my problem and give me some suggestions to improve the Notebook.

Thanks for your attention.

Chenghua

POSTED BY: Chenghua Deng
2 Replies
Posted 1 year ago

My first guess is "bad starting values for numerical root findinig."

As a quick experiment, changing

{{n,h},{p1,0},{p2,0}}

to

{{n,h/2},{p1,h/2},{p2,h/2}}

in your Mathematica notebook makes all the complex numbers go away in this particular example.

But I cannot be sure that experiment is always choosing a good starting point for each of your variables in FindRoot. ListPlot of each of the roots do not seem to show sudden large changes like I would expect if my experiment was choosing some bad starting values.

POSTED BY: Bill Nelson
Posted 1 year ago

Thank you very much, I followed your suggestion and got the normal result of the equations. It seems to be caused by the starting value issue.

enter image description here

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

Group Abstract Group Abstract