0
$\begingroup$

Given the following code:

ClearAll[a, sector, cap, lab, va, fd, μ, γ, outputS, priceS, gdpS];
a = 
  {{58/493, 75/831, 98/900}, 
   {123/493, 342/831, 198/900}, 
   {178/493, 215/831, 343/900}} // N}
sector = 3;
cap = {110/493, 150/831, 200/900};
lab = {24/493, 49/831, 61/900};  
va = cap + lab;
fd = {262/493, 168/831, 164/900};  
μ = {0.05, 0.00, 0.00};
γ = {0.15, 0.00, 0.00};  
outputS = (Inverse[IdentityMatrix[sector] - (1 + γ)*a].fd)
priceS = (valueAdded.Inverse[IdentityMatrix[sector] - (1 + μ)*a])
gdpS = priceS.outputS

Note that I have two-parameter vectors μ and γ (taking values between 0 and 1) but I only change one element from each vector (in this example, the first element from each vector), while keeping the rest of the parameters unchanged. How can I construct:

ContourPlot[gdpS == 1.5, {μ, ...}, {γ, ...}]

for a given value of gdpS = 1.5, while changing only two elements from two-parameter vectors.

$\endgroup$
3
  • 1
    $\begingroup$ I am missing something: At the moment, gdpS only depends on the parameter a, which is not defined, but it does not depend on $\mu$ or $\gamma$. You could re-define outputS and priceS to be functions of $\mu$ and $\gamma$, though. $\endgroup$ – MarcoB Jan 10 '20 at 18:28
  • $\begingroup$ @MarcoB: Sorry. I noticed something weird in my post. I will edit it immediately. $\endgroup$ – Tugrul Temel Jan 10 '20 at 18:38
  • $\begingroup$ @MarcoB: Thanks for the code. a is a given matrix. I will try your answer with this matrix. I hope it will solve my problem. $\endgroup$ – Tugrul Temel Jan 10 '20 at 18:53
4
$\begingroup$

Redefine your outputS, priceS, gdpS functions to explicitly depend on μ and γ:

ClearAll[outputSfunction, priceSfunction, gdpSfunction]
outputSfunction[γ_] := (Inverse[IdentityMatrix[sector] - (1 + γ)*a].fd)
priceSfunction[μ_] := (valueAdded.Inverse[IdentityMatrix[sector] - (1 + μ)*a])
gdpSfunction[μ_, γ_] := priceSfunction[μ].outputSfunction[γ]

Then, after assigning an arbitrary value to a that would allow the function to attain the value of $1.5$, since one was not provided:

Block[{a = 0.4},
 ContourPlot[
   gdpSfunction[{firstMu, 0, 0}, {firstGamma, 0, 0}],
   {firstMu, 0, 1}, {firstGamma, 0, 1},
   Contours -> {1.5}
 ]
]

contour plot

$\endgroup$
4
  • 1
    $\begingroup$ Your answer works fine by simply replacing a with a matrix (3,3). I simply inserted matrix a into Block[{a=matrix data},...]. thank you very much. $\endgroup$ – Tugrul Temel Jan 10 '20 at 19:07
  • $\begingroup$ @Tugrul Great! Glad to hear that. $\endgroup$ – MarcoB Jan 10 '20 at 19:13
  • $\begingroup$ Can we have a ContourPlot in 3D where any two elements from [Mu] and one element from [Gamma] change? Analogous to {x,y,z} plane, I want to have a plane with {mu1, mu2, gamma1} where gamma1 is the surface (height). $\endgroup$ – Tugrul Temel Jan 10 '20 at 21:22
  • 1
    $\begingroup$ @Tugrul ContourPlot3D would probably work, with the appropriate modifications. It may be trying to convey too much information in one plot though. $\endgroup$ – MarcoB Jan 10 '20 at 21:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.