comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » IDL inverse matrix problem??
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: IDL inverse matrix problem?? [message #90085 is a reply to message #90083] Fri, 23 January 2015 12:06 Go to previous messageGo to previous message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
On Friday, January 23, 2015 at 12:56:35 PM UTC-7, Amin Farhang wrote:
> Hi,
>
> Let me try an example in IDL and matlab for example:
>
>
> In IDL:
>
> IDL> Am =[[-6.8599934d+16,-8.3590379d+16,-1.8742199d+17,1.5697952d+1 7, 1.1607144d+17],$
> IDL> [-1.2228319d+17,-1.4900449d+17,-3.3409009d+17,2.7982470d+17, 2.0690379d+17],$
> IDL> [-1.4972730d+17,-1.8244569d+17,-4.0907020d+17,3.4262599d+17, 2.5333938d+17],$
> IDL> [-1.0612015d+17,-1.2930950d+17,-2.8993102d+17,2.4283828d+17, 1.7955584d+17],$
> IDL> [-1.1696076d+17,-1.4251900d+17,-3.1954867d+17,2.6764521d+17, 1.9789821d+17]]
> IDL> Bm = la_invert(Am)
> IDL> Cm = Am ## Bm
> IDL> print,Cm
> 0.99999999 -3.7252903e-09 -1.2107193e-08 -7.4505806e-08 8.9406967e-08
> -1.4901161e-08 1.0000000 -1.2107193e-08 -1.0430813e-07 1.1920929e-07
> -1.4901161e-08 -7.4505806e-09 0.99999997 -1.4901161e-07 8.9406967e-08
> -1.4901161e-08 -7.4505806e-09 -1.4901161e-08 0.99999990 8.9406967e-08
> -1.4901161e-08 -2.6077032e-08 -2.0489097e-08 -1.4901161e-07 1.0000002
>
> As you see the AA-1 is not a complete identity matrix
>
>
> In matlab:
>
> Am = [ [-6.8599934e+16 , -8.3590379e+16 , -1.8742199e+17 , 1.5697952e+17 , 1.1607144e+17];...
> [-1.2228319e+17 , -1.4900449e+17 , -3.3409009e+17 , 2.7982470e+17 , 2.0690379e+17];...
> [-1.4972730e+17 , -1.8244569e+17 , -4.0907020e+17 , 3.4262599e+17 , 2.5333938e+17];...
> [-1.0612015e+17 , -1.2930950e+17 , -2.8993102e+17 , 2.4283828e+17 , 1.7955584e+17];...
> [-1.1696076e+17 , -1.4251900e+17 , -3.1954867e+17 , 2.6764521e+17 , 1.9789821e+17]];
>
> Bm = inv(Am);
> Cm = Am * Bm
>
> 1.0000 -0.0000 -0.0000 -0.0000 0.0000
> 0 1.0000 -0.0000 0.0000 -0.0000
> -0.0000 -0.0000 1.0000 0 0
> -0.0000 0.0000 -0.0000 1.0000 0.0000
> -0.0000 0 -0.0000 -0.0000 1.0000
>
> As you see the result is a identity matrix
>
>
> Best,

Hi Amin,

I don't think that last example is actually the identity matrix. I would bet that Matlab is only printing out a few digits, so it just looks like the identity matrix. What happens if you print out all of the digits using a Matlab command like fprintf('%13.9f\n', Cm)?

-Chris
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: HASH assignment
Next Topic: saving an output from the find.pro script

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:48:03 PDT 2025

Total time taken to generate the page: 0.00294 seconds