Hello! I am enjoying using Mathematica on a daily basis, but as I am a newbie I do not manage to do everthing I want , yet.
How do I tell Mathematica to compute f(f(x)) when f(x)=(x+3)^2 or something like that?
Best regards, Ulf Karlsson
Thanks!
//Ulf
Basically,
f[x_]:=(x+3)^2
would define a function of the variable x. Such that f[1]=16 and f[-1]=4 etc. Then you can write f[f[x]]
x
f[1]=16
f[-1]=4
f[f[x]]
You can also write
f@f@x
See here and here. This latter link is a good resource in my opinion.
Good luck!
And glad to help.
I would do it this way:
f[x_] := (x + 3)^2; f[f[x]]
Beware the difference between square brackets and round parentheses, and between the pattern x_ and the variable x.
x_