The Math Forum



Search All of the Math Forum:

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


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

Topic: Approximate Zero Times A Symbol
Replies: 2   Last Post: Jun 29, 2012 4:53 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Peter Breitfeld

Posts: 424
Registered: 12/7/04
Re: Approximate Zero Times A Symbol
Posted: Jun 29, 2012 4:48 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply


To make these 0. vanish I use:

IntNull[expr_] := ((expr //. Complex[x_, 0.] -> x) //. {0. -> 0})


"djmpark" wrote:

> What is the justification for the following?
>
>
>
> 0. x + 1. y
>
>
>
> 0. + 1. y
>
>
>
> I want to display a dynamic weighted sum of x and y and sometimes one of the
> coefficients becomes zero. I would like to keep both terms (for a steady
> display) and format with NumberForm. If Mathematica is going to drop the x,
> why doesn't it at least also drop the approximate zero?
>
>
>
> If I use SetPrecision we obtain:
>
>
>
> SetPrecision[0. x + 1. y, 10]
>
>
>
> 1.000000000 y
>
>
>
> which is at least more consistent, but not what I want either.
>
>
>
> David Park
>
> djmpark@comcast.net
>
> http://home.comcast.net/~djmpark/index.html
>


--
_________________________________________________________________
Peter Breitfeld | Bad Saulgau, Germany | http://www.pBreitfeld.de




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

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2017. All Rights Reserved.