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: How to remove the "0." from "0. + 1.41774i"
Replies: 8   Last Post: Jun 23, 2013 10:50 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
cj.girlie@gmail.com

Posts: 2
Registered: 6/21/13
Re: How to remove the "0." from "0. + 1.41774i"
Posted: Jun 21, 2013 5:43 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On Thursday, June 20, 2013 4:01:33 AM UTC-4, Mike Bayville 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


Try this

ToExpression[StringReplace[ToString[0. + 1.41774 i], "0." -> "" ]]

Effective but not elegant




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.