CGI/Perl Guide | Learning Center | Forums | Advertise | Login Site Search: in Perl Guide PerlGuru Forums Learning Ctr
 MAIN INDEX SEARCHPOSTS WHO'S ONLINE 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 (7832 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 ?

rovf
Veteran

Sep 4, 2012, 6:00 AM

Post #2 of 4 (7819 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 (7802 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 (7795 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

 Announcements     PerlGuru Announcements Perl Programming Help     Frequently Asked Questions     Beginner     Intermediate     Advanced     Regular Expressions     mod_perl     DBI     Win32 Programming Help Fun With Perl     Perl Quizzes - Learn Perl the Fun Way     Perl Golf     Perl Poetry Need a Custom or Prewritten Perl Program?     I need a program that...     I Need a Programmer for Freelance Work     Throw Down The Gauntlet General Discussions     General Questions     Feedback     Tutorial/Article Suggestions for The Learning Cent     Internet Security Other Programming Languages     Javascript     PHP

 Search this forum this category all forums for All words Any words Whole Phrase (options) Powered by Gossamer Forum v.1.2.0