Solution for system of two non linear equation
Show older comments
Hello everyone! I want to solve the following set of equations for Ns and Nonegative
other parameters like Nd, kb,T,Ed and E0 are given. please guide me
B*((Nd-Ns-Nonegative)/(Ns*(Ns+Nonegative)))=exp(Ed/(kb*T)) ..........................(1)
(Nd-Ns-Nonegative)*(No-Nonegative)/(Nonegative*(Ns-Nonegative))=exp((Ed-E0)/(kb*T)).....................(2)
Accepted Answer
More Answers (1)
Anil Kumar
on 24 May 2020
3 Comments
Anil Kumar
on 24 May 2020
Alex Sha
on 24 May 2020
there are two set of solutionas:
1:
x1: -7.92007748296389E19
x2: 1866379606242.77
2:
x1: -7.92557459212419E19
x2: 6.70668919804731E19
Are Mjaavatten
on 25 May 2020
The problem is that your function varies so fast it cannot be calculated accurately enough using Matlab's doubles, which can only give around 15 decimals accuracy. Example: By increasing the input by the smallest amout possible, the function value varies by 3*10^25!:
>> X0 = [1,1];X1 = X + [eps,0];
>> f0 = B*((Nd-X0(1)-X0(2))/(Ns*(X0(1)+X0(2))))-(exp(Ed/(Kb*T)));
>> f1 = B*((Nd-X1(1)-X1(2))/(Ns*(X1(1)+X1(2))))-(exp(Ed/(Kb*T)));
>> f0-f1
ans =
2.901421967075110e+25
In order to solve this you will need to use high-precisison numerics. I believe this is possible using the symbolic toolbox, which I do not have. I did manage to solve your problem using the 'decimal' package in Python. Using 70 digits precision (which was probably an overkill) I got the results:
x = 4995902546762269.237720253171526889970117329871362498338512315098994153
y = 5003466623785482.322209836772145823825707627909875825586084623755567318
If you put this into Matlab, the values will get rounded to 15 digits and the second equation will not yield 0 but -2.84e15!
I recommend that you take another look at your equations and parameters to see if they are correct or if they may be reformulated.
I did have some nerdy fun figuring this out though!
Categories
Find more on Systems of Nonlinear Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!