Welcome to Dream.In.Code
Become a PHP Expert!

Join 136,936 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,854 people online right now. Registration is fast and FREE... Join Now!




how to inverse a metrices in php? help me.....

 
Reply to this topicStart new topic

how to inverse a metrices in php? help me.....

husna_feza
27 Mar, 2008 - 08:25 PM
Post #1

New D.I.C Head
*

Joined: 27 Mar, 2008
Posts: 2

morning guys out there...rite now i'm having problem on how to inverse a matrix using php code..i had the idea in my head, but i dunno how to transform it in a programming terms..
help me please...
User is offlineProfile CardPM
+Quote Post

chrisman
RE: How To Inverse A Metrices In Php? Help Me.....
27 Mar, 2008 - 09:06 PM
Post #2

New D.I.C Head
Group Icon

Joined: 22 Mar, 2008
Posts: 41



Thanked: 1 times
Dream Kudos: 100
My Contributions
A matrix or an array? Coding would be helpful. If it is an array, there is a simple solution.

php

<?php
$input = array ("php", 4.0, array ("green", "red"));
$result = array_reverse ($input);
?>


In $input, the values are:

php

<?php
$input[0] // returns "php"
$input[1] // returns 4.0
$input[2][0] // returns "green"
$input[2][1] // returns "red"
?>



php

<?php
$result[0][0] // returns "green"
$result[0][1] // returns "red"
$result[1] // returns 4.0 (still)
$result[2] // returns "php"
?>


If this isn't what you meant, please give some more info on what you do want.
User is offlineProfile CardPM
+Quote Post

husna_feza
RE: How To Inverse A Metrices In Php? Help Me.....
27 Mar, 2008 - 09:58 PM
Post #3

New D.I.C Head
*

Joined: 27 Mar, 2008
Posts: 2

tenks for giving me that.. smile.gif but actually the problem is, i'm dealing with nxn matrix which need me to inverse it..i this kind of matrix..
[code] //B'-matrix to find the value of deltaDel
print ("B'-matrix<br>");
for($i=1;$i<=$totalbus;$i++)
{
if(($buscode[$i]==0)||($buscode[$i]==2))
{
for($j=1;$j<=$totalbus;$j++)
{
if(($buscode[$j]==0)||($buscode[$j]==2))
{
$B1matrix[$busnum[$i][$j]]=$matrix_imgpart[$i][$j];
print($B1matrix[$busnum[$i][$j]]." ");
}
}
}
print("<br>");
}
print("<br>");

//B''-matrix to find the value of deltaVolt
print ("B''-matrix");
for($i=1;$i<=$totalbus;$i++)
{
if($buscode[$i]==2)
{
for($j=1;$j<=$totalbus;$j++)
{
if($buscode[$j]==2)
{
$B2matrix[$busnum[$i][$j]]=$matrix_imgpart[$i][$j];
print($B2matrix[$busnum[$i][$j]]." ");
}
}
}
print("<br>");
}
print("<br>");
[code]

and now i have to inverse the matrix..another problem is, the matrix that im dealing with is not only 3x3 matrix..it could be 4x4 or 2x2.. so, i cant fixed the equation to inverse it.

really hope that u can help me to solve it..
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/3/08 10:45PM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month