CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

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

 



appetitto
Novice

Sep 3, 2012, 5:01 AM

Post #1 of 4 (3808 views)
How to take a solution of linear equations with PDL Can't Post

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

Post #2 of 4 (3795 views)
Re: [appetitto] How to take a solution of linear equations with PDL [In reply to] Can't Post


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

Post #3 of 4 (3778 views)
Re: [rovf] How to take a solution of linear equations with PDL [In reply to] Can't Post

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

Post #4 of 4 (3771 views)
Re: [Laurent_R] How to take a solution of linear equations with PDL [In reply to] Can't Post

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

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives