Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Issue with the submatrix in mathematica(version 7)
Replies: 2   Last Post: Mar 7, 2013 10:47 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Bob Hanlon

Posts: 895
Registered: 10/29/11
Re: Issue with the submatrix in mathematica(version 7)
Posted: Mar 7, 2013 10:47 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Use Chop

http://reference.wolfram.com/mathematica/ref/Chop.html

{2.28983*10^-16 + 2.22045*10^-16 I, -2.16493*10^-15 + 2.10942*10^-15 I,
2.77556*10^-16 + 1.38778*10^-17 I,
3.9443*10^-31 - 9.46633*10^-30 I, -1.10441*10^-29 -
3.54987*10^-29 I, -8.67747*10^-30 - 2.36658*10^-29 I,
1. - 2.498*10^-16 I, -2.22045*10^-16 - 4.85723*10^-17 I, -1.31839*10^-16 +
1.66533*10^-16 I,
3.15544*10^-30 + 3.47099*10^-29 I, -1.26218*10^-29 - 2.52435*10^-29 I,
4.41762*10^-29 + 2.8399*10^-29 I} // Chop

{0, 0, 0, 0, 0, 0, 1., 0, 0, 0, 0, 0}

{2.42861*10^-16 + 3.46945*10^-16 I, -2.16493*10^-15 + 2.10942*10^-15 I,
2.22045*10^-16 + 2.77556*10^-17 I,
1.20178*10^-31 - 9.61886*10^-30 I, -1.32134*10^-29 -
3.69902*10^-29 I, -9.26912*10^-30 - 2.41342*10^-29 I,
1. - 2.498*10^-16 I, -2.63678*10^-16 - 4.16334*10^-17 I, -1.249*10^-16 +
1.66533*10^-16 I,
8.03652*10^-30 + 2.7339*10^-29 I, -1.76015*10^-29 - 2.55024*10^-29 I,
4.22534*10^-29 + 2.86702*10^-29 I} // Chop

{0, 0, 0, 0, 0, 0, 1., 0, 0, 0, 0, 0}

{-0.0530074 - 0.0169643 I, -0.225895 - 0.0305394 I,
0.0479921 - 0.0377367 I, -2.15746*10^-16 -
6.66211*10^-16 I, -9.30951*10^-16 + 2.85235*10^-15 I,
3.88901*10^-16 + 1.56189*10^-15 I,
1.00746 + 0.0488354 I, -0.0227522 + 0.00304178 I, 0.0678515 - 0.00137899 I,
5.32924*10^-15 - 2.56555*10^-15 I, -2.99839*10^-15 + 3.08487*10^-15 I,
3.60046*10^-16 - 4.89453*10^-15 I} // Chop

{-0.0530074 - 0.0169643 I, -0.225895 - 0.0305394 I,
0.0479921 - 0.0377367 I, 0, 0, 0,
1.00746 + 0.0488354 I, -0.0227522 + 0.00304178 I,
0.0678515 - 0.00137899 I, 0, 0, 0}


Bob Hanlon


On Thu, Mar 7, 2013 at 3:59 AM, Haosheng Shi <dvorak518@gmail.com> wrote:
> I'm faced with a very strange problem in mathematica 7
> In Algebra, if we decompose a matrix into some column vectors,such as
> B={B1,B2...Bi...Bn}
> then the product of the matrix is expected to be
> A.B[[All,i]=(A.B)[[All,i]]
>
> mathematica gives a good result when dealing with symbols like A=Array[a,{n,n}]. But when cope with the numerical calculation, it will make some serious mistakes
>
> t1 = Inverse[SPPS - TPSM.(Inverse[RMMinv]).TMPS].(TPSPp - TPSM.(Inverse[RMMinv]).RMPp)[[1 ;; 12, 7]]
> t2 = (Inverse[SPPS - TPSM.(Inverse[RMMinv]).TMPS].(TPSPp - TPSM.(Inverse[RMMinv]).RMPp))[[1 ;; 12, 7]]
> t4 = Inverse[SPPS - TPSM.(Inverse[RMMinv]).TMPS].(TPSP7 - TPSM.(Inverse[RMMinv]).RMP7)
>
> the result is
>
> {2.28983*10^-16 + 2.22045*10^-16 I, -2.16493*10^-15 +
> 2.10942*10^-15 I, 2.77556*10^-16 + 1.38778*10^-17 I,
> 3.9443*10^-31 - 9.46633*10^-30 I, -1.10441*10^-29 -
> 3.54987*10^-29 I, -8.67747*10^-30 - 2.36658*10^-29 I,
> 1. - 2.498*10^-16 I, -2.22045*10^-16 -
> 4.85723*10^-17 I, -1.31839*10^-16 + 1.66533*10^-16 I,
> 3.15544*10^-30 + 3.47099*10^-29 I, -1.26218*10^-29 -
> 2.52435*10^-29 I, 4.41762*10^-29 + 2.8399*10^-29 I}
>
> {2.42861*10^-16 + 3.46945*10^-16 I, -2.16493*10^-15 +
> 2.10942*10^-15 I, 2.22045*10^-16 + 2.77556*10^-17 I,
> 1.20178*10^-31 - 9.61886*10^-30 I, -1.32134*10^-29 -
> 3.69902*10^-29 I, -9.26912*10^-30 - 2.41342*10^-29 I,
> 1. - 2.498*10^-16 I, -2.63678*10^-16 -
> 4.16334*10^-17 I, -1.249*10^-16 + 1.66533*10^-16 I,
> 8.03652*10^-30 + 2.7339*10^-29 I, -1.76015*10^-29 - 2.55024*10^-29 I,
> 4.22534*10^-29 + 2.86702*10^-29 I}
>
> {-0.0530074 - 0.0169643 I, -0.225895 - 0.0305394 I,
> 0.0479921 - 0.0377367 I, -2.15746*10^-16 -
> 6.66211*10^-16 I, -9.30951*10^-16 + 2.85235*10^-15 I,
> 3.88901*10^-16 + 1.56189*10^-15 I,
> 1.00746 + 0.0488354 I, -0.0227522 + 0.00304178 I,
> 0.0678515 - 0.00137899 I,
> 5.32924*10^-15 - 2.56555*10^-15 I, -2.99839*10^-15 +
> 3.08487*10^-15 I, 3.60046*10^-16 - 4.89453*10^-15 I}
>
> Can you help me??
>





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.