Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: "Alternating" function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg63275] Re: [mg63260] "Alternating" function
  • From: "David Park" <djmp at earthlink.net>
  • Date: Thu, 22 Dec 2005 00:04:36 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Renan,

What about using Fold?

Fold[x + #2*f[#1] & , x, Table[(-1)^i, {i, 5}]]
x - f[x + f[x - f[x + f[x - f[x]]]]]

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/



From: Renan [mailto:renan.birck at gmail.com]
To: mathgroup at smc.vnet.net

Hello,

I want to make a "nested function" like: x + f[x - f[x + f[x - f[x +
f[x]]]]].

I've tried using Nest but I don't find how to keep switching between
Plus and Minus: I would need something that would return an "index" so
I could keep track of when I need to "switch" the operation. (e.g. if
the "index" is odd, the operation is "Plus", otherwise is "Minus")

How can I make this? I looked in the help but didn't find any informations.

Thanks.


  • Prev by Date: Re: Convincing Mathematica that Sqrt[a+b]Sqrt[a-b]==Sqrt[a^2+b^2]
  • Next by Date: Re: "Alternating" function
  • Previous by thread: Re: "Alternating" function
  • Next by thread: Re: "Alternating" function