[Date Index]
[Thread Index]
[Author Index]
Re: Approximate Zero Times A Symbol
*To*: mathgroup at smc.vnet.net
*Subject*: [mg127118] Re: Approximate Zero Times A Symbol
*From*: "djmpark" <djmpark at comcast.net>
*Date*: Sun, 1 Jul 2012 02:08:32 -0400 (EDT)
*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com
*References*: <201206270811.EAA18698@smc.vnet.net> <19783652.3140.1340794328091.JavaMail.root@m06> <jsh3a9$sir$1@smc.vnet.net> <18402214.58885.1341077225203.JavaMail.root@m06>
Thanks for your reply Richard.
Basically I was interested in formatting a vector a x + b y to so many
places and keeping both terms present even when a or b was an approximate
zero. (My dislike of Dynamic displays that jitter and jump.) Your example
set me onto:
0.00000000000000000000000 x
0.*10^-23 x
The x was not dropped! Why was that? Because there is a difference between
Precision and Accuracy and Mathematica behaves differently in this respect.
(I don't know the rationale.)
This lead me to:
0.000``7 x + 0.9823645 y
NumberForm[%, {7, 6}, NumberFormat -> (# &)]
0.*10^-7 x + 0.982365 y
0.000000 x +0.982364 y
where the NumberFormat option is necessary. But how do I get the Accuracy
set on the coefficients before Mathematica drops the x or y? I finally
settled on the following:
angle = 0.0``8;
Slider[Dynamic[angle, (angle = SetAccuracy[#, 8]) &], {0., 90.},
Appearance -> "Labeled"]
Dynamic@NumberForm[Cos[angle Degree] x + Sin[angle Degree] y, {7, 6},
NumberFormat -> (# &)]
That works, but my complaint is the time required to find a work-around
because Mathematica normally drops an undefined symbol. One has to know the
Accuracy "trick" and the NumberFormat "trick". How likely is the average
user going to find that out, just to get a steady dynamic display? There are
other methods, Bob Hanlon has presented a couple, and I was using a Rule
replacement. But it still chews up time.
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/index.html
From: Richard Fateman [mailto:fateman at cs.berkeley.edu]
On 6/28/2012 1:06 AM, djmpark wrote:
....
The symbol x has a meaning, as one of
> the basic elements of the algebra, that the scalar 0.0 does not have.
> Using
> 0.0 x -> 0.0 changes the mathematical meaning of the expression.
>
This is certainly a useful discussion point. If x is "inches" then 0.0
* x still has a dimension (inches). If x is a vector, there is possibly a
distinction worth drawing between a zero vector and a scalar.
Etc.
On the other hand, 0.0 in Mathematica means something other than
mathematical zero in various versions of Mathematica. Though who can tell
about the future.
Try this.
h = 0.50000000000000000000000
Do[ h = 2*h - h}, {i, 1, 50}]
h
One might think that h, being 0. would have the property that h*x would be
0. Also that h+1 would be 1. But you would be wrong.
In the version 8 Mathematica, numbers like that 0. are displayed in a pink
box, but of course there is no requirement that you print the
result, and if you utter If[h==0,yes,no] the answer is "yes".
So for programs it might as well be 0 if it is equal to 0.
Aside: The pink box is not quite the right size. Too small. My suggestion
(and implementation) was to display numbers with no significant digits in
red.
http://forums.wolfram.com/mathgroup/archive/2010/Jan/msg00897.html
I should have patented it :)
Prev by Date:
**Re: case of inconsistent API between Drop and Part?**
Next by Date:
**Re: Rearranging terms - user-defined**
Previous by thread:
**Re: Approximate Zero Times A Symbol**
Next by thread:
**Re: Approximate Zero Times A Symbol**
| |