Services & Resources / Wolfram Forums
MathGroup Archive
*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
  • Subject: [mg63281] Re: "Alternating" function
  • From: "Borut Levart" <BoLe79 at>
  • Date: Thu, 22 Dec 2005 00:04:44 -0500 (EST)
  • References: <doamp5$em8$>
  • Sender: owner-wri-mathgroup at

Module[{i = 1},
  Nest[x + ((-1)^i++)*f[#] &, x + f[x], 4]

This does what you desire to do. Note the increment of i by one in
every Nest-iteration, and so an alternative sign before f. For a shift
in signs by one, change the starting value of i in Module by one.

Greetings from Slovenia,
Borut Levart

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