Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #15988 > unrolled thread
| Started by | "Sjoerd C. de Vries" <sjoerd.c.devries@gmail.com> |
|---|---|
| First post | 2011-02-07 11:05 +0000 |
| Last post | 2011-02-07 11: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.
Re: Pattern matching "Sjoerd C. de Vries" <sjoerd.c.devries@gmail.com> - 2011-02-07 11:05 +0000
| From | "Sjoerd C. de Vries" <sjoerd.c.devries@gmail.com> |
|---|---|
| Date | 2011-02-07 11:05 +0000 |
| Subject | Re: Pattern matching |
| Message-ID | <iiojll$gi0$1@smc.vnet.net> |
I guess that when n reaches 0 Mathematica is smart enough to
understand that 0*fact[-1] == 0 independent of the value of
fact[-1]...
Cheers -- Sjoerd
On Feb 6, 11:35 am, StatsMath <stats.ma...@gmail.com> wrote:
> Have a question regarding the applicaiton of pattern rules:
>
> fact[4] //. {fact[n_] :> n fact[n-1], fact[0] -> 1}
>
> This is a bug since fact[0] needs to be defined 1st, but I expected
> the above to grind away idefnitely but it returned a a value 0,
> instead of an infininte computation.
>
> Can you help me understand why the above returns 0?
>
> Thanks!
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web