Home: Perl Programming Help: Advanced:
How to take a solution of linear equations with PDL

appetitto
Novice

Sep 3, 2012, 5:01 AM

Views: 7816
 How to take a solution of linear equations with PDL
Hi,

I ve got a lot of linear equations and I would like to take a solution of it.

Let's assume that we have sth like this:

Ax + B = Y (line) and we know points (0,1) and (2,3).

I want to account A and B, so I prepared the matrices:

my \$m1 = pdl [ [ 0, 1], [ 2, 1] ];

my \$m2 = pdl [ [1], [3],];

Now I would like to do something like this:
\$res = \$m1 / \$m2 which do it and return solution for me. Of course '/' does not work (from Matlab)

How can I take it ?

Thanks in advance

rovf
Veteran

Sep 4, 2012, 6:00 AM

Views: 7803
 Re: [appetitto] How to take a solution of linear equations with PDL
 Quote
Of course '/' does not work (from Matlab)

What makes you think '/' does not work in Perl, and why are you refering to Matlab here?

Or - do you need rational arithmetic?

Laurent_R
Veteran / Moderator

Sep 4, 2012, 10:52 AM

Views: 7786
 Re: [rovf] How to take a solution of linear equations with PDL
I understand that Appetitto wants to divide a matrix by a vector. But I have no idea whether this works in the PDL module.

Actually I remember multiplying matrices or vectors, but I don't remember what dividing a matrix by a vector is.

rovf
Veteran

Sep 5, 2012, 1:10 AM

Views: 7779
 Re: [Laurent_R] How to take a solution of linear equations with PDL
Hmmm... Talking I have never heard about matrix division in mathematics either. There is one thing which comes close to division. It is related to the *outer* product between two matrices (i.e. the product which yields a new matrix). If you have the equation

M1 x M2 = M3

where 'x' denotes outer product, and in you have given M2 and M3 and want to calculate M1, you have to right-multiply M3 with the *inverse* of M1. Now in a scalar world, taking the inverse is related to division (the inverse of 5 is 1/5, for instance), so in this case we might talk of matrix division.

In any case, I think the OP should express more clearly what he is looking for...

Ronald