Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #14950 > unrolled thread

Re: How to remove the "0." from "0. + 1.41774i"

Started byBob Hanlon <hanlonr357@gmail.com>
First post2013-06-21 09:41 +0000
Last post2013-06-21 09:41 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: How to remove the "0." from "0. + 1.41774i" Bob Hanlon <hanlonr357@gmail.com> - 2013-06-21 09:41 +0000

#14950 — Re: How to remove the "0." from "0. + 1.41774i"

FromBob Hanlon <hanlonr357@gmail.com>
Date2013-06-21 09:41 +0000
SubjectRe: How to remove the "0." from "0. + 1.41774i"
Message-ID<kq174b$gn5$1@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@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
>
>

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web