Chapter 1 - An Introduction to Mathematica

Section 1.4 - Expressions Versus Functions

g=5 x+9

g/.x->1

f[x_]=5 x+9

f[1]

g/.x->Sin[x]

f[Sin[x]]

h=f@f[x]

Simplify[h]

Nest[f,f[x],1]

Simplify[%]

Nest[f,f[x],1]/.x->2

Nest[f,f[x],5]

Simplify[%]

f[x_]=Piecewise[{{Sin[x],x≤-2},{Cos[x],x>-2&&x≤3},{-x+5,x>3}}]

Plot[f[x],{x,-π,2π},PlotStyle-> {Red,Thick}]