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


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

Re: Approximate Zero Times A Symbol

Started byBob Hanlon <hanlonr357@gmail.com>
First post2012-06-28 08:05 +0000
Last post2012-06-28 08:05 +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: Approximate Zero Times A Symbol Bob Hanlon <hanlonr357@gmail.com> - 2012-06-28 08:05 +0000

#10668 — Re: Approximate Zero Times A Symbol

FromBob Hanlon <hanlonr357@gmail.com>
Date2012-06-28 08:05 +0000
SubjectRe: Approximate Zero Times A Symbol
Message-ID<jsh37d$sh4$1@smc.vnet.net>
Use Rationalize

expr = 0. x + 1. y;

expr // Rationalize

y

expr // Rationalize[#, 0] &

y

If there are any rational factors remaining you can use N with any
desired precision to return to reals.


Bob Hanlon


On Wed, Jun 27, 2012 at 4:11 AM, djmpark <djmpark@comcast.net> 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

[toc] | [standalone]


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


csiph-web