RE: Transformation rules for Floor/Ceiling

• To: mathgroup at smc.vnet.net
• Subject: [mg17072] RE: [mg16953] Transformation rules for Floor/Ceiling
• From: maharri at my-dejanews.com
• Date: Fri, 23 Apr 1999 02:32:10 -0400
• Organization: Deja News - The Leader in Internet Discussion
• References: <7es2at\$ca0@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```In article <7es2at\$ca0 at smc.vnet.net>,
"Ersek, Ted R" <ErsekTR at navair.navy.mil> wrote:
> Mitch Harris wrote:
> -----------------------
> I am trying to come up with a set of transformation rules (in Mathematica)
> to help
> simplify formulas involving Floor and Ceiling. There are a number of
> identities for these (e.g. Ceiling[a/b] = Floor[a+b-1/b] if b is an
> integer).
> Since anykind of programming is difficult from scratch, I'd like to see some
> examples to see if I'm going about it in the right manner.
>
> 1) I've done a web search for something like this and I can't find anything
> of
> the sort. Have you ever seen something like this (and if so, do you have
> pointers as to how to do it)?
>
> 2) The Mathematica docs give some ideas (when to use :> rather than ->,
> checking
> FullForm to make sure you're matching the appropriate patterns). But I'd
> really like to see a large example, like for instance the actual
> transformation rules that Mathematica uses for polynomials or trig (i.e. the
> internal
> rules it uses for Simplify, FullSimplify, Reduce, TrigReduce, etc.). Any
> ideas? Pointers?
>
> ----------------------
>
> You said:
> Ceiling[a/b] = Floor[a+b-1/b] if b is an integer
>
> Where did you ever get that idea?
>
> In[1]:=
> Ceiling[7/8]
> Out[1]=
> 1
>
> In[2]:=
> Ceiling[7+8-1/8]
> Out[2]=
> 15

Please Pardon the egregious omission of parentheses. It should be:

Ceiling[a/b] = Floor[(a+b-1)/b] if b is an integer
^     ^

That should make things correct (the subtle part is the condition that b be an
integer).

> Well if you are still interested see (ReIm.m) in the standard packages.

Yes, still interested. A few combinatorics packages have some good examples.
HYP.m (for hypergeometric functions), gosper.m (for factorials and binomials,
sort of a precursor to HYP.m). So I'm still looking for (and trying to create)
appropriate rules for integer arithmetic.

> Also goto
> http://www.mathsource.com/Content/Enhancements/Algebraic
> and look at:
> - NonNegativeQ
>
> - Generalization of Abs and Arg for symbolic expressions
>
> - ExactNumber.m  A package to improve the handling of mixtures of exact and
> inexact numbers

Thanks. Those are a good start.

> Anyway I am having a hard time coming up with rules that are always true
> without very restrictive conditions.

Yes. That seems to be my trouble, too.

-----------== Posted via Deja News, The Discussion Network ==----------