# Plotting a function of another function

Edit: So I have several functions which come from other functions. For example:

beta [alpha_, sd_, rf_] := (1/2) - (alpha/(sd^2)) +
Sqrt[(((alpha/(sd^2)) - (1/2))^2) + (2*rf/(sd^2))];

Yss[alpha_, sd_, rf_, iss_] := (1/2) - (alpha/(sd^2)) +
Sqrt[(((alpha/(sd^2)) - (1/2))^2) + (2*(rf + iss)/(sd^2))];

optVS [wa_, ea_, ewi_, kapa_, alpha_, sd_, iss_,
rf_] := ((beta[alpha, sd, rf]/(beta[alpha, sd, rf] - 1))*(ea -
wa))/((beta[alpha, sd, rf]/(beta[alpha, sd, rf] - 1))*(ea -
wa) + ((Yss[alpha, sd, rf, iss]/(
Yss[alpha, sd, rf, iss] - 1))*(kapa + wa - ewi)))  ;

VS[wa_, ewi_, kapa_, alpha_, sd_, rf_, ea_,
iss_] := ((beta[alpha, sd,
rf]/(beta[alpha, sd, rf] -
1))*((wa - ewi + kapa)/(1 -
optVS [wa, ea, ewi, kapa, alpha, sd, iss, rf])));


You can see that optVS is part of VS. What I would like to do is plot VS in Y-Axis and optVS in X-Axis. I know that plots usually use a function and then a range for a variable like:

Plot[VS[wa, ewi, kapa, alpha, sd, rf, ea, iss],{iss,0,1}]


However, what I want to do is to see the values of VS for the corresponding optVS. Can someone help me?

• It is very difficult to figure out what you want. Can you please provide more details in your post? What kinds of functions are x and y. If you want to parametrically plot as a function of x, why is x[a,b] in the definition of y rather than just just x? What are c and d? Parameters? -- if so, please provide specific values for them. Variables? -- if so, then ParametricPlot is probably not what you want. Without more details, this is likely to be closed as "unclear what you are asking". May 6, 2016 at 15:55
• Sorry, I still haven't figured out how to ask questions properly.. I will edit! May 6, 2016 at 16:34
• Can someone just tell me if I'm not getting answers because: 1)Stupid question 2)Impossible to do 3)Can't understand question May 6, 2016 at 17:39
• 1) and 3). It's beyond my concentration level to even read through all your code. Check for the questions with several votes and see how they are constructed, that may help you on your next one. May 6, 2016 at 22:54

Assuming the functions beta and Yss are the ones defined in your other question, that is,

beta[alpha_, sd_, rf_] := (1/2) - (alpha/(sd^2)) +
Sqrt[(((alpha/(sd^2)) - (1/2))^2) + (2*rf/(sd^2))];
Yss[alpha_, sd_, rf_, iss_] := (1/2) - (alpha/(sd^2)) +
Sqrt[(((alpha/(sd^2)) - (1/2))^2) + (2*(rf + iss)/(sd^2))];
optVS[wa_, ea_, ewi_, kapa_, alpha_, sd_, iss_, rf_] :=
((beta[alpha, sd, rf]/(beta[alpha, sd, rf] - 1))*(ea - wa))/
((beta[alpha, sd, rf]/(beta[alpha, sd, rf] - 1))*(ea - wa) +
((Yss[alpha, sd, rf, iss]/(Yss[alpha, sd, rf, iss] - 1))*(kapa + wa - ewi)));
VS[wa_, ewi_, kapa_, alpha_, sd_, rf_, ea_, iss_] :=
((beta[alpha, sd, rf]/(beta[alpha, sd, rf] - 1))*((wa - ewi + kapa)/
(1 - optVS[wa, ea, ewi, kapa, alpha, sd, iss, rf])));


you can use ParametricPlot by picking any one of the parameters to get a parametric curve for {optVS, VS} for fixed values of the other parameters. You can also pick a second parameter to get a family of curves. In the following, this is done by using the parameter wa to parametrize a curve, and ea to get a family of curves and fixing the rest of the parameters.

alpha = 0.02; ewi = 50; iem = 0.02; iss = 0.05; kapa = 900; rf = 0.05; sd = 0.5;
labels = ("ea = " <> ToString[#]) & /@ Range[0, 400, 50];

Legended[ParametricPlot[Evaluate[{optVS[wa, #, ewi, kapa, alpha, sd, iss, rf],
VS[wa, ewi, kapa, alpha, sd, rf, #, iss]} & /@ Range[0, 400, 50]], {wa, 0, 400},
PlotLabel -> Style["wa ∈ (0,400)", 20], AxesLabel -> (Style[#, 16]& /@ {"optVS", "VS"}),
Axes -> True, Frame -> False, AspectRatio -> 1],
LineLegend[ColorData[1] /@ #, labels[[#]]] &@Range[Length@labels]] /. Line -> Arrow


You can pick any two of your parameters to play the role of wa and ea in the example above.

You can vary the fixed parameters using Manipulate (again borrowing pieces from your other question):

Manipulate[ With[{labels = ("ea = " <> ToString[#]) & /@ Range[0, 400, 50]},
With[{n = Length@labels},
Legended[ ParametricPlot[Evaluate[{optVS[wa, #, ewi, kapa, alpha, sd, iss, rf],
VS[wa, ewi, kapa, alpha, sd, rf, #, iss]} & /@ Range[0, 400, 50]],
{wa, 0, 400}, AxesLabel -> {"optVS", "VS"}, Axes -> True, Frame -> False,
AspectRatio -> 1] /. Line -> Arrow,
LineLegend[ColorData[1] /@ #, labels[[#]]] &@Range@n]]],
{{rf, 0.05}, .03, .05, Appearance -> "Labeled"},
{{iss, 0.05}, 0, 0.10, Appearance -> "Labeled"},
{{sd, 0.5}, 0.0001, 1, Appearance -> "Labeled"},
{{kapa, 900}, 0, 2000, Appearance -> "Labeled"},
{{alpha, 0.02}, 0, 0.20, Appearance -> "Labeled"},
{{ewi, 50}, 0, 300, Appearance -> "Labeled"}, ControlPlacement -> Left]


Or, you can add ea to the Manipulate variables:

Manipulate[ ParametricPlot[{optVS[wa, ea, ewi, kapa, alpha, sd, iss, rf],
VS[wa, ewi, kapa, alpha, sd, rf, ea, iss]}, {wa, 0, 400},
AxesLabel -> {"optVS", "VS"}, Axes -> True, Frame -> False,
AspectRatio -> 1] /. Line -> Arrow,
{{rf, 0.05}, .03, .05,  Appearance -> "Labeled"},
{{iss, 0.05}, 0, 0.10,  Appearance -> "Labeled"},
{{sd, 0.5}, 0.0001, 1,  Appearance -> "Labeled"},
{{kapa, 900}, 0, 2000,  Appearance -> "Labeled"},
{{alpha, 0.02}, 0, 0.20, Appearance -> "Labeled"},
{{ewi, 50}, 0, 300, Appearance -> "Labeled"}, {{ea, 50}, 0, 400},
ControlPlacement -> Left]


Finally, you can also use a two parameter version of ParametricPlot to get a parametric region:

Manipulate[ParametricPlot[{optVS[wa, ea, ewi, kapa, alpha, sd, iss, rf],
VS[wa, ewi, kapa, alpha, sd, rf, ea, iss]},
{wa, 0, 400}, {ea, 0, 400}, AxesLabel -> {"optVS", "VS"},
Axes -> True, Frame -> False, AspectRatio -> 1, BoundaryStyle -> None,
MeshFunctions -> {#3 &, #4 &}, Mesh -> {5, 5},  MeshStyle -> {Red, Blue}],
{{rf, 0.05}, .03, .05, Appearance -> "Labeled"},
{{iss, 0.05}, 0, 0.10, Appearance -> "Labeled"},
{{sd, 0.5}, 0.0001, 1, Appearance -> "Labeled"},
{{kapa, 900}, 0, 2000, Appearance -> "Labeled"},
{{alpha, 0.02}, 0, 0.20, Appearance -> "Labeled"},
{{ewi, 50}, 0, 300, Appearance -> "Labeled"}, ControlPlacement -> Left]


• Wow that is amazing! I am still digesting it slowly but thank you very much for your answer :D May 6, 2016 at 22:58