I am trying to convert a piece of octave code to numpy but I got different results from octave and numpy. Here are my Data (in fact they are far larger than given data below):
A =
Columns 1 through 6:
1.000000000000000e+00 9.954090291002812e-01 9.820064469806473e-01 9.908807141567176e-01 9.954090291002812e-01 9.908807141567179e-01
9.954090291002812e-01 1.000000000000000e+00 9.954090291002812e-01 9.776578008378289e-01 9.908807141567179e-01 9.954090291002812e-01
9.820064469806473e-01 9.954090291002812e-01 1.000000000000000e+00 9.567491788333946e-01 9.776578008378289e-01 9.908807141567179e-01
9.908807141567176e-01 9.776578008378289e-01 9.567491788333946e-01 1.000000000000000e+00 9.954090291002812e-01 9.820064469806473e-01
9.954090291002812e-01 9.908807141567179e-01 9.776578008378289e-01 9.954090291002812e-01 1.000000000000000e+00 9.954090291002812e-01
9.908807141567179e-01 9.954090291002812e-01 9.908807141567179e-01 9.820064469806473e-01 9.954090291002812e-01 1.000000000000000e+00
9.776578008378289e-01 9.908807141567179e-01 9.954090291002812e-01 9.608235911808946e-01 9.820064469806473e-01 9.954090291002812e-01
9.776578008378289e-01 9.649505047327671e-01 9.448300707857176e-01 9.954090291002812e-01 9.908807141567179e-01 9.776578008378289e-01
9.820064469806473e-01 9.776578008378289e-01 9.649505047327671e-01 9.908807141567179e-01 9.954090291002812e-01 9.908807141567179e-01
9.776578008378289e-01 9.820064469806473e-01 9.776578008378289e-01 9.776578008378289e-01 9.908807141567179e-01 9.954090291002812e-01
9.649505047327671e-01 9.776578008378289e-01 9.820064469806473e-01 9.567491788333946e-01 9.776578008378289e-01 9.908807141567179e-01
9.567491788333946e-01 9.448300707857176e-01 9.259179407344914e-01 9.820064469806473e-01 9.776578008378289e-01 9.649505047327671e-01
9.608235911808946e-01 9.567491788333946e-01 9.448300707857176e-01 9.776578008378289e-01 9.820064469806473e-01 9.776578008378289e-01
9.567491788333946e-01 9.608235911808946e-01 9.567491788333946e-01 9.649505047327671e-01 9.776578008378289e-01 9.820064469806473e-01
9.448300707857176e-01 9.567491788333946e-01 9.608235911808946e-01 9.448300707857176e-01 9.649505047327673e-01 9.776578008378289e-01
Columns 7 through 12:
9.776578008378289e-01 9.776578008378289e-01 9.820064469806473e-01 9.776578008378289e-01 9.649505047327671e-01 9.567491788333946e-01
9.908807141567179e-01 9.649505047327671e-01 9.776578008378289e-01 9.820064469806473e-01 9.776578008378289e-01 9.448300707857176e-01
9.954090291002812e-01 9.448300707857176e-01 9.649505047327671e-01 9.776578008378289e-01 9.820064469806473e-01 9.259179407344914e-01
9.608235911808946e-01 9.954090291002812e-01 9.908807141567179e-01 9.776578008378289e-01 9.567491788333946e-01 9.820064469806473e-01
9.820064469806473e-01 9.908807141567179e-01 9.954090291002812e-01 9.908807141567179e-01 9.776578008378289e-01 9.776578008378289e-01
9.954090291002812e-01 9.776578008378289e-01 9.908807141567179e-01 9.954090291002812e-01 9.908807141567179e-01 9.649505047327671e-01
1.000000000000000e+00 9.567491788333946e-01 9.776578008378289e-01 9.908807141567179e-01 9.954090291002812e-01 9.448300707857176e-01
9.567491788333946e-01 1.000000000000000e+00 9.954090291002812e-01 9.820064469806473e-01 9.608235911808946e-01 9.954090291002812e-01
9.776578008378289e-01 9.954090291002812e-01 1.000000000000000e+00 9.954090291002812e-01 9.820064469806473e-01 9.908807141567179e-01
9.908807141567179e-01 9.820064469806473e-01 9.954090291002812e-01 1.000000000000000e+00 9.954090291002812e-01 9.776578008378289e-01
9.954090291002812e-01 9.608235911808946e-01 9.820064469806473e-01 9.954090291002812e-01 1.000000000000000e+00 9.567491788333946e-01
9.448300707857176e-01 9.954090291002812e-01 9.908807141567179e-01 9.776578008378289e-01 9.567491788333946e-01 1.000000000000000e+00
9.649505047327673e-01 9.908807141567179e-01 9.954090291002812e-01 9.908807141567179e-01 9.776578008378289e-01 9.954090291002812e-01
9.776578008378289e-01 9.776578008378289e-01 9.908807141567179e-01 9.954090291002812e-01 9.908807141567179e-01 9.820064469806473e-01
9.820064469806473e-01 9.567491788333946e-01 9.776578008378289e-01 9.908807141567179e-01 9.954090291002812e-01 9.608235911808946e-01
Columns 13 through 15:
9.608235911808946e-01 9.567491788333946e-01 9.448300707857176e-01
9.567491788333946e-01 9.608235911808946e-01 9.567491788333946e-01
9.448300707857176e-01 9.567491788333946e-01 9.608235911808946e-01
9.776578008378289e-01 9.649505047327671e-01 9.448300707857176e-01
9.820064469806473e-01 9.776578008378289e-01 9.649505047327673e-01
9.776578008378289e-01 9.820064469806473e-01 9.776578008378289e-01
9.649505047327673e-01 9.776578008378289e-01 9.820064469806473e-01
9.908807141567179e-01 9.776578008378289e-01 9.567491788333946e-01
9.954090291002812e-01 9.908807141567179e-01 9.776578008378289e-01
9.908807141567179e-01 9.954090291002812e-01 9.908807141567179e-01
9.776578008378289e-01 9.908807141567179e-01 9.954090291002812e-01
9.954090291002812e-01 9.820064469806473e-01 9.608235911808946e-01
1.000000000000000e+00 9.954090291002812e-01 9.820064469806473e-01
9.954090291002812e-01 1.000000000000000e+00 9.954090291002812e-01
9.820064469806473e-01 9.954090291002812e-01 1.000000000000000e+00
and
b =
-1.024208397018539
-1.055718555015945
-1.066560607689640
-1.187368188387253
-1.258866007703282
-1.305258462589997
-1.321354530870290
-1.333661132027602
-1.421384660329320
-1.478743779481671
-1.498725636719488
-1.385960967135295
-1.479663779776475
-1.541078471216082
-1.562500000000000
In octave I have x = b'/A
. I could not find corresponding numpy function for /
. So far I tried x = np.dot(b.T,np.linalg.inv(A))
from numpy but the results are not same as octave.
The results of octave for x = b'/A
are:
x =
Columns 1 through 6:
-5.642309525591432e+00 7.813412870218545e+00 -1.559855155426489e+02 -3.597241224212262e+01 2.201914551287831e+02 -3.100354445411479e+02
Columns 7 through 12:
7.253956488595386e+02 7.369595892720794e+01 -4.313273469816049e+02 6.064725968037579e+02 -9.855235323530542e+02 -4.111380598448122e+01
Columns 13 through 15:
2.334109900297194e+02 -3.269547704109582e+02 4.254317069619117e+02
and the results of numpy are
x=np.array([[-5.642310487492068, 7.813414778371225, -155.9855165364133, -35.9724138597885, 220.1914623928024, -310.0354544342263, 725.3956532399461, 73.69596218669903, -431.3273588509765, 606.472611254314, -985.5235383154941, -41.11380770278629, 233.4109958125337, -326.9547770833597, 425.4317096135928]])
I would appreciate if someone can help me to find same results as in octave by numpy. Or closer than current the results to Octave results.