numpy (matrix solver) - python vs. matlab
Nasser M. Abbasi
nma at 12000.org
Sun Apr 29 21:35:54 EDT 2012
On 04/29/2012 07:59 PM, someone wrote:
>>
>> Also, as was said, do not use INV(A) directly to solve equations.
>
> In Matlab I used x=A\b.
>
good.
> I used inv(A) in python. Should I use some kind of pseudo-inverse or
> what do you suggest?
>
I do not use python much myself, but a quick google showed that pyhton
scipy has API for linalg, so use, which is from the documentation, the
following code example
X = scipy.linalg.solve(A, B)
But you still need to check the cond(). If it is too large, not good.
How large and all that, depends on the problem itself. But the rule of
thumb, the lower the better. Less than 100 can be good in general, but I
really can't give you a fixed number to use, as I am not an expert in
this subjects, others who know more about it might have better
recommendations.
--Nasser
More information about the Python-list
mailing list