Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #14950
| From | Bob Hanlon <hanlonr357@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: How to remove the "0." from "0. + 1.41774i" |
| Date | 2013-06-21 09:41 +0000 |
| Message-ID | <kq174b$gn5$1@smc.vnet.net> (permalink) |
| References | <20130620084452.627F569EF@smc.vnet.net> |
| Organization | Time-Warner Telecom |
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@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
>
>
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: How to remove the "0." from "0. + 1.41774i" Bob Hanlon <hanlonr357@gmail.com> - 2013-06-21 09:41 +0000
csiph-web