Re: How to remove the "0." from "0. + 1.41774i"
- To: mathgroup at smc.vnet.net
- Subject: [mg131242] Re: How to remove the "0." from "0. + 1.41774i"
- From: Bob Hanlon <hanlonr357 at gmail.com>
- Date: Fri, 21 Jun 2013 05:57:10 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-outx@smc.vnet.net
- Delivered-to: mathgroup-newsendx@smc.vnet.net
- References: <20130620084452.627F569EF@smc.vnet.net>
A pure imaginary number is represented as a complex number. If it is
inexact, it will have 0. as the real part.
I//FullForm
Complex[0,1]
I//N
0. + 1.*I
To suppress display of the zero real part, the number needs to be exact
(e.g., rationals).
A={{-1.2,1.5},{-2.3,1.2}};
eigenvalues=Eigenvalues[A]//Rationalize[#,10^-16]&
{(116833629*I)/82408088,
-((116833629*I)/82408088)}
eigenvalues//FullForm
List[Complex[0,Rational[116833629,82408088]],Complex[0,Rational[-116833629,82408088]]]
eigenvalues//N
{0. + 1.4177446878757822*I,
0. - 1.4177446878757822*I}
Alternatively, use exact numbers throughout
A=Rationalize[A]
{{-(6/5), 3/2}, {-(23/10), 6/5}}
eigenvalues=Eigenvalues[A]
{(I*Sqrt[201])/10,
-((I*Sqrt[201])/10)}
eigenvalues//N
{0. + 1.4177446878757827*I,
0. - 1.4177446878757827*I}
Bob Hanlon
On Thu, Jun 20, 2013 at 4:44 AM, Mike Bayville <mike.bayville at gmail.com>wrote:
> Can anyone suggest a built-in function for removing the "0." from "0. +
> 1.41774i"?
>
> Thanks!
>
> Mike
>
> INPUT
> A={{-1.2, 1.5}, {-2.3, 1.2}};
> Clear[eigenvalue];
> {eigenvalue[1], eigenvalue[2]} = Chop[Eigenvalues[A]]
> Chop[eigenvalue[1]]
> Chop[eigenvalue[2]]
>
> OUTPUT
> {0. + 1.41774i, 0. - 1.41774i}
> 0. + 1.41774i
> 0. - 1.41774i
>
>
- References:
- How to remove the "0." from "0. + 1.41774i"
- From: Mike Bayville <mike.bayville@gmail.com>
- How to remove the "0." from "0. + 1.41774i"