This variant works reasonably well. We sum absolute values of discrepancies (instead of squares).
eqs = {7.61 ==
0. - (26.3 + 7.6*Rs)/Rp -
1. (-1 + E^((38.91741123737115*(26.3 + 7.61*Rs))/A)) Subscript[i,
o] + Subscript[i, ph],
8.21 == 0. - (8.21*Rs)/Rp -
1. (-1 + E^((319.51194625881715*Rs)/A)) Subscript[i, o] +
Subscript[i, ph],
0 == 0. - 32.9/Rp -
1. (-1 + E^(1280.3828297095108/A)) Subscript[i, o] +
Subscript[i, ph],
6.62 == 0. - (6.62*Rs)/Rp -
1. (-1 + E^((239.92927434638457*Rs)/A)) Subscript[i, o] +
Subscript[i, ph],
0 == 0. - 29.9/Rp -
1. (-1 + E^(1083.668474766903/A)) Subscript[i, o] +
Subscript[i, ph]};
exprs = Apply[Subtract, eqs, {1}];
obj = Total[Abs[exprs]];
vars = {Rp, Rs, Subscript[i, o], Subscript[i, ph], A};
One can try various methods in NMinimize
. I had best results from simulated annealing, though possibly that was just luck.
SeedRandom[1111]; Quiet[
res = Table[
NMinimize[obj, vars,
Method -> {"SimulatedAnnealing",
"RandomSeed" -> RandomInteger[100000]}], {8}]]
(* Out[128]= {{1.87674549158, {Rp -> -22.1775022222, Rs -> 27.1223664498,
Subscript[i, o] -> -1.27242985435,
Subscript[i, ph] -> -0.211055515253,
A -> -0.0309130227249}}, {1.64764584763, {Rp -> -36.2638152639,
Rs -> 42.3746667989, Subscript[i, o] -> -1.06207524175,
Subscript[i, ph] -> -0.053467535256,
A -> -1.5217022262}}, {0.019707815217, {Rp -> -1107.10143767,
Rs -> 1110.76425648, Subscript[i, o] -> 0.806310397178,
Subscript[i, ph] -> -0.83347298941,
A -> -0.0264490342706}}, {0.736993699664, {Rp -> -45.9270205782,
Rs -> 49.3700088231, Subscript[i, o] -> 0.348644661474,
Subscript[i, ph] -> -0.999677531674,
A -> -0.462683666199}}, {0.137667678614, {Rp -> -1453.74805012,
Rs -> 1469.63492588, Subscript[i, o] -> -38.3974516083,
Subscript[i, ph] -> 38.3251067397,
A -> -0.368567703104}}, {1.12405053251, {Rp -> -29.1065949187,
Rs -> 32.7292298606, Subscript[i, o] -> -2.26521557848,
Subscript[i, ph] -> 1.23795697332,
A -> -1.34684133875}}, {0.0936124366274, {Rp -> -559.623069958,
Rs -> 565.599281418, Subscript[i, o] -> -3.10557765226,
Subscript[i, ph] -> 3.03488269939,
A -> -2.72662194692}}, {1.43175063852, {Rp -> -23.0445680163,
Rs -> 27.0491806745, Subscript[i, o] -> -3.23518621627,
Subscript[i, ph] -> 1.80847818916, A -> -1.44644488489}}} *)
The third has a small residual so we'll check how close we come with it.
exprs /. {Rp -> -1107.1014376711053`,
Rs -> 1110.7642564780667`, Subscript[i, o] -> 0.8063103971775648`,
Subscript[i, ph] -> -0.833472989409748`, A -> -0.026449034270631236`}
(* Out[130]= {-0.0117375546656,
2.2635415764*10^-9, -0.0025546485558, 0.00526047949255, \
0.000155130239452} *)
An alternative is to use a sum of squares and give NMinimize
some nondefault settings.
obj = exprs.exprs;
SeedRandom[1111]; Quiet[
res = Table[
NMinimize[obj, vars,
Method -> {"RandomSearch",
"RandomSeed" -> RandomInteger[100000]}], {8}]]
(* Out[150]= {{3.53513331148*10^-6, {Rp -> -2822.92221197,
Rs -> 2827.13076594, Subscript[i, o] -> -0.0332358721578,
Subscript[i, ph] -> 0.0222353109126,
A -> -31.9630925697}}, {6.24332180567*10^-7, {Rp -> -2700.49545384,
Rs -> 2705.67999858, Subscript[i, o] -> 0.000018778654236,
Subscript[i, ph] -> -0.0116263048577,
A -> 160412.601173}}, {3.53513331148*10^-6, {Rp -> -2822.92221197,
Rs -> 2827.13076594, Subscript[i, o] -> -0.512019293981,
Subscript[i, ph] -> 0.501018732736,
A -> -0.00380045704701}}, {3.53513331148*10^-6, {Rp -> \
-2822.92221197, Rs -> 2827.13076594,
Subscript[i, o] -> 0.353615439225,
Subscript[i, ph] -> -0.36461600047,
A -> -0.689503356585}}, {3.58492039403*10^-6, {Rp -> \
-2905.05796609, Rs -> 2909.30416484, Subscript[i, o] -> -38.346593732,
Subscript[i, ph] -> 38.3359024824,
A -> -8.35575763632}}, {3.53513331148*10^-6, {Rp -> -2822.92221197,
Rs -> 2827.13076594, Subscript[i, o] -> -0.165396243166,
Subscript[i, ph] -> 0.154395681921,
A -> -0.648193065037}}, {3.53513331148*10^-6, {Rp -> \
-2822.92221197, Rs -> 2827.13076594,
Subscript[i, o] -> -0.01209512964,
Subscript[i, ph] -> 0.00109456839478,
A -> -1.01228544162}}, {3.53513331148*10^-6, {Rp -> -2822.92221197,
Rs -> 2827.13076594, Subscript[i, o] -> -2.27722923527,
Subscript[i, ph] -> 2.26622867403, A -> -1.20741804005}}} *)
We check the quality of the best of these.
exprs /. {Rp -> -2700.4954538433844`,
Rs -> 2705.6799985799325`,
Subscript[i, o] -> 0.000018778654235991685`,
Subscript[i, ph] -> -0.01162630485766281`, A -> 160412.60117315938`}
(* Out[149]= {0.0000695635876515, -0.0000413467732426, \
-0.000556494251506, -0.0000273792092713, 0.000554389807918} *)
So now our residuals are all under 1/1000.
I need to look into the memory allocation failure when using a sum of squares wit h default method.