MathGroup Archive 2003

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

Search the Archive

Re: Taking a function as a parameter of a function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg41854] Re: [mg41834] Taking a function as a parameter of a function
  • From: Bobby Treat <drmajorbob-MathGroup3528 at mailblocks.com>
  • Date: Sat, 7 Jun 2003 00:08:43 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

test[y1_, x_, y_] := Table[y1 /. {x -> x + i, y -> y + i}, {i, 3}]
test[x^2 + y^2, x, y]

Bobby

-----Original Message-----
From: JustNImge <justnimge at angelfire.com>
To: mathgroup at smc.vnet.net
Subject: [mg41854] [mg41834] Taking a function as a parameter of a function

Hi everyone I'm new to this group and new to Mathematica in general. 
Actually I'm taking a class in it but we've had very little hands on 
experience. Anyway, I was wondering if it was possible to take a 
function as a parameter of another function. What I've been trying to 
do is make a list of x^2+y^2 but increase x and y by one each time so I 
would have (x+1)^2+(y+1)^2 etc. Actually the function I'm trying to 
write for my class is more complicated than that but I'm trying to 
figure this out first. When I try to do this, I get: In[5]:= 
test[y1_[x_,y_]]:=Table[y1[x+i,y+i],{i,3}] In[6]:= test[x^2+y^2] 2 2 2 
2 2 2 Out[6]= {2 + x + y , 4 + x + y , 6 + x + y } Is it just not 
possible to take x and y as their own parameters like this? I'm sorry 
if this has been addressed before but when I browsed subjects last 
night there didn't seem to be anything within the first 100. Thank you 
very much for any and all help. JustNImge 


  • Prev by Date: Re: creating functions from the result of Solve[]
  • Next by Date: Re: Explain this (error in Plot[Evaluate[Range[3]],{x,0,1}])
  • Previous by thread: Taking a function as a parameter of a function
  • Next by thread: Re: Taking a function as a parameter of a function