Strange Min/Max result
- To: mathgroup at smc.vnet.net
- Subject: [mg62324] Strange Min/Max result
- From: neillclift at msn.com
- Date: Sat, 19 Nov 2005 23:19:24 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
While playing with a equation for addition chains I wanted to manipulate something like this: n = 2i + Sum[Min[i - j, 2^(d - r + 1 - j)], {j, 0, r - 3}] Now Mathematica doesn't seem to be able to do much with equations like this. I had no clue but Mathematica knows much more than me. I happened to be flipping though The Mathematica Guidebook for Symbolics and saw this being used: max[x_, y_] := 1/2(x + y + Sqrt[(x - y)^2]) Very smart. So I thought I could do: min1[x_, y_] := 1/2(x + y - Sqrt[(x - y)^2]) This gives the wrong results though: n = 2i + Sum[min1[i - j, 2^(d - r + 1 - j)], {j, 0, r - 3}] n = 2^(2+d-2r)(-4+2^r) + 2i I can see its wrong with something like this: n = 2i + Sum[min1[ i - j, 2^(d - r + 1 - j)], {j, 0, r - 3}] /. d -> 8 /. r -> 4 /. i -> 16 n = 80 The real answer is n = 2i + Sum[Min[ i - j, 2^(d - r + 1 - j)], {j, 0, r - 3}] /. d -> 8 /. r -> 4 /. i -> 16 n = 63 So whats going on here and is there any way to manipulate equations with Min and Max in them? Thanks. Neill.
- Follow-Ups:
- Re: Strange Min/Max result
- From: Andrzej Kozlowski <akoz@mimuw.edu.pl>
- Re: Strange Min/Max result