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


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

Approximate Zero Times A Symbol

Started by"djmpark" <djmpark@comcast.net>
First post2012-06-27 08:15 +0000
Last post2012-06-29 08:53 +0000
Articles 3 — 3 participants

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


Contents

  Approximate Zero Times A Symbol "djmpark" <djmpark@comcast.net> - 2012-06-27 08:15 +0000
    Re: Approximate Zero Times A Symbol Peter Breitfeld <phbrf@t-online.de> - 2012-06-29 08:48 +0000
    Re: Approximate Zero Times A Symbol Vince Virgilio <blueschi@gmail.com> - 2012-06-29 08:53 +0000

#10655 — Approximate Zero Times A Symbol

From"djmpark" <djmpark@comcast.net>
Date2012-06-27 08:15 +0000
SubjectApproximate Zero Times A Symbol
Message-ID<jsefei$iah$1@smc.vnet.net>
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 

[toc] | [next] | [standalone]


#10679

FromPeter Breitfeld <phbrf@t-online.de>
Date2012-06-29 08:48 +0000
Message-ID<jsjq53$ctq$1@smc.vnet.net>
In reply to#10655
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

[toc] | [prev] | [next] | [standalone]


#10689

FromVince Virgilio <blueschi@gmail.com>
Date2012-06-29 08:53 +0000
Message-ID<jsjqek$d1o$1@smc.vnet.net>
In reply to#10655
On Wednesday, June 27, 2012 4:15:14 AM UTC-4, djmpark wrote:
> What is the justification for the following?
>
> 
>
> 0. x + 1. y
>
> 
>
> 0. + 1. y
>

This appears to be an active area of Mathematica development. I think WRI improves their definition of "zero" with each release. Perhaps the next spin will give at least a more consistent result (0. + 1. y = 1. y), though not your desired one. If I recall correctly, earlier releases gave 0. * x -> 0. * x .

Vince Virgilio

[toc] | [prev] | [standalone]


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


csiph-web