# Plot a function for different values of parameters

I have a function:

u[r_] := 1/2*(uj + u∞) -
1/2*(uj - u∞)*Tanh[1/4*Rθ*(r/R - R/r)]


Where:

uj = 1;
u∞ = 0;
R = 1;


I want to plot:

Plot[(u[r/R] - u∞)/(uj - u∞), {r, 0, 3},
PlotRange -> All]


But for three different values of parameters Rθ, some like that:

Plot[(u[r/R] - u∞)/(uj - u∞), {r, 0, 3},
PlotRange -> All] /.{Rθ->10,Rθ->5,Rθ->2.5}


How to do that?

• It is better to write your function such that the parameters are also arguments to your function: u[uj_, u∞_, R_, Rθ_, r_] := 1/2*(uj + u∞) - 1/2*(uj - u∞)*Tanh[1/4*Rθ*(r/R - R/r)] Feb 27, 2019 at 0:34

Plot[Evaluate[(u[r/R] - u∞)/(uj - u∞) /. {{Rθ -> 10}, {Rθ ->  5}, {Rθ -> 2.5}}], {r, 0, 3},
PlotRange -> All]


Also:

Plot[Evaluate[Table[(u[r/R] - u∞)/(uj - u∞), {Rθ, {10, 5, 2.5}}]], {r, 0, 3},
PlotRange -> All]


same picture

Here is another way to get the desired result as pointed out in the comment,

uj = 1; u\[Infinity] = 0; R = 1;

u[r_, R\[Theta]_] :=  1/2*(uj + u\[Infinity]) -
1/2*(uj - u\[Infinity])*Tanh[1/4*R\[Theta]*(r/R - R/r)]

Plot[Evaluate[u[r, #] & /@ {10, 5, 2.5}], {r, 0, 3}]