       Re: managing order of magnitude instead of numbers

• To: mathgroup at smc.vnet.net
• Subject: [mg56703] Re: [mg56672] managing order of magnitude instead of numbers
• From: Chris Chiasson <chris.chiasson at gmail.com>
• Date: Wed, 4 May 2005 00:33:31 -0400 (EDT)
• References: <200505030926.FAA25648@smc.vnet.net>
• Reply-to: Chris Chiasson <chris.chiasson at gmail.com>
• Sender: owner-wri-mathgroup at wolfram.com

```Assuming you have defined an order of magnitude function, (don't call
it O.. that is a reserved symbol).. have it return the result wrapped
in a special head (again, don't call it O). You could use upvalues to
determine that the subtraction of two orders of magnitude is equal to
the greater order of magnitude.

In:=
TagSet[ODM,ODM[a_]-ODM[b_],ODM[Max[a,b]]]
Out=
ODM[Max[a,b]]
In:=
ODM-ODM
Out=
ODM

On 5/3/05, foice <foice@n0nspammar&tiscali.it> wrote:
> i need to make calculation without specifing the exact values of my
> parameters, i want only to specify their order of magnitude.
> obviously i need only order of magnitudes as result.
>
> now the problem is that
>
> O(1) - O(1) = O(1)
>
> while
>
> 1-1 = 0
>
> so it's clear i cannot use numbers to make this "order of magintude
> calculation"
>
> at the present stage i let mathematica do the calculation in a fully
> simbolic way and then, by hand calculation, i get my result by
> susbstitution of the order of magnitudes in place of the symobls used.
>
> making a very simple example:
>
> i ask to mathematica to do
>
> a - b
>
> and then i substitute
>
> a=O(1)
>
> b=O(0.002)
>
> and calculate
>
> a - b = O(1)
>
> in this way i'm  making operation between magnitues not values, but i
> have to do it on my own, while doing calculation with mathematica will
> be much better.
>
> is there any way to make calculation betwwen order of magnitues
>
> thanks.
> roberto.
>
>

--
Chris Chiasson
http://chrischiasson.com/
1 (810) 265-3161

```

• Prev by Date: Cases and Nonatomic expression
• Next by Date: how call a function by same name in 2 different contexts?