Taking a function as a parameter of a function
- To: mathgroup at smc.vnet.net
- Subject: [mg41834] Taking a function as a parameter of a function
- From: justnimge at angelfire.com (JustNImge)
- Date: Fri, 6 Jun 2003 09:51:09 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
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