# [Numpy-discussion] solving linear equations

salahudeen razac salahudeen03@gmail....
Fri Mar 9 00:33:16 CST 2012

```I wrote a script to solve the equation ‘*P =Kd .V2 + Kl.VA.BT + C’* . To
solve the equation I have used the matrix method.

Ie, K*X = P          where

*[P] = [             P1*

*                                **P2
a column matrix with the total powers P1, P2,P3…….PN at (V1,T1),(V2,T2)……(
VN.TN) respectively,\*

*                        P3*

*                                ..*

*                                **PN  ]*

* *

*                                    [K] = [            V12      V1A.BT1
1*

*                                                            V22      V2A.B
T2    1*

*                                                            V32      V3A.B
T3    1*

*                                                            ………………………..*

*                                                            VN2      VNA.B
TN    1 ]*

* *

*                                    [X]= [ Kd                           A
column matrix with the unknowns*

*                                                                **Kl*

*                                                                **C  ]*

Now in order to solve multiply both sides with KT, ie             *KT.K.X =
KTP *or *A.X = B* where *A*=* KT.K *and* B*=* KTP*

*
*

Now we will get the matrix X by using *linalg.solve(A,B*) function which
will eventually solve for a set of linear equations of the form Ax=B*
*

I was able to get the solution. But it is not acceptable since some of the
values are negative. SO I want to know is there any way to give some
constraints like the solution should contain only positive values and give
any range for the solution?

I also tried with linalg.lstsq and I am getting the same results
*
-----
Salahudeen razak* *| +917760902602*

*o__*
* _> /__
(_) \(_)*... *Burn fat not fuel
*
*
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20120309/84a43492/attachment.html
```