Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*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 2006

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

Search the Archive

Re: Recursion inspection technique : HoldForm but release variables

  • To: mathgroup at smc.vnet.net
  • Subject: [mg66413] Re: [mg66361] Recursion inspection technique : HoldForm but release variables
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Thu, 11 May 2006 05:35:56 -0400 (EDT)
  • References: <200605110613.CAA17024@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On 11 May 2006, at 15:13, flatmax wrote:

> Hi,
>
> If I define a recursion and hold its form to inspect it :
> Clear[test]
> test[j_Integer?Positive] :=
>                               test[j] = k[j] HoldForm[ test[j - 1] ]
>
> then This is what happens :
>
>    In[22]:= test[4]
>
> Out[22]:= test[4 - 1] k[4]
>
> But I would like it to be with the variable evaluated :
>
> Out[22]:= test[3] k[4]
>
> Whats the trick ???
>
> thanks
> Matt
>


For example:

test[j_Integer?Positive] :=test[j] = With[{p = j - 1}, (k[j] HoldForm 
[ test[p] ])]

test[4]


HoldForm[test[3]]*k[4]

Andrzej Kozlowski

Tokyo, Japan


  • Prev by Date: Re: Creating a new table using values from a column in another table,
  • Next by Date: Re: Applying rules to SparseArray
  • Previous by thread: Recursion inspection technique : HoldForm but release variables
  • Next by thread: Recursion inspection technique : HoldForm but release variables