5

Clear["Global`*"] y[a_, k_, l_, d_] := a*k^d*l^(1 - d); mpl[a_, k_, l_, d_] := (1 - d)*a*k^d*l^(-d); lsupply[b_, m_, l_] := b + m*l; l should not be an argument to intersectlabor. Use NSolve intersectlabor[a_?NumericQ, k_?NumericQ, d_?NumericQ, b_?NumericQ, m_?NumericQ] := {l, mpl[a, k, l, d]} /. NSolve[{mpl[a, k, l, d] == lsupply[b, m, l], ...


5

Manipulate[Plot[Evaluate@ OutputResponse[TransferFunctionModel[(5/(s^2 + 2 s)*K1)/(1 + 5/(s^2 + 2 s)*(K2*s + K1)), s], UnitStep[t], {t, 0, 10}], {t, 0, 4}, PlotRange -> {0, 3}], {{K1, 1}, 0, 3}, {{K2, 2}, 0, 3}]


4

Mesh and MeshFunctions is work. Here we write a MeshFunctions such as MeshFunctions -> Function[l, mpl[a, k, l, d] - lsupply[b, m, l]] and set Mesh->{{0}} indicate that mpl[a, k, l, d] - lsupply[b, m, l]==0,so we need not solve the equation by hand. Clear["Global`*"] y[a_, k_, l_, d_] = a*k^d*l^(1 - d); mpl[a_, k_, l_, d_] = (1 - d)*a*k^d*l^(...


4

The problem here is the way the replacements are made. ODE is a replacement rule that looks like: {{x[t] -> 1 + t}} The Manipulate effectively tries to evaluate something like the following (for some value of t you selected): DynamicModule[{t = 10}, ListPlot[{{x[t] /. ODE, 0}}]] The problem here is that during the evaluation, x[t] first gets evaluated ...


3

Your sins are many. Here are the ones I found. There may be others, but by correcting (in some cases rather arbitrarily) the ones I noticed, I was able to get a working Manipulate. Writing bτ where you should write b*τ. Writing duplicate definitions for dAC, dAA,dBB,dBC. Not scoping your control variables correctly. Not wrapping your Plot expression with ...


3

Yes! The answer is to use a combination of Module, With, and Apply's (@@) to build things. Here's an example: test[n_] := Module[{x}, With[{vars = Table[x[i], {i, 1, n}]}, Manipulate[ListPlot[vars, PlotRange -> {0, 1}], ##] & @@ MapThread[{#1, #2[[1]], #2[[2]]} &, {vars, Table[{0, 1}, {i, 1, n}]}]]] This should give a plot of n ...


3

Something is wrong on your side. It may be lingering definitions, or something else elusive, but your code works with the definitions you provided. I would only recommend NOT starting with $b=0$ and $c=0$, because that will correspond to an empty plot... (Note the explicitly non-zero starting values in the Manipulate below) Pccxx[x_, b_, c_] = c (x - 1) + b (...


3

Manipulate[ sol = NDSolve[{a'[t] == -I*a[t] (delta + g*Re[b[t]]) - a[t]*0.04/2, b'[t] == -I (b[t]*delta + g*Abs[a[t]]^2) - a[t]*0.09/2, a[0] == 1, b[0] == 1}, {a, b}, {t, 0, 200}]; ParametricPlot[{Re[b'[t]], Re[b[t]]} /. sol, {t, 0, 200}, PerformanceGoal -> "Quality"], {g, 0.000001, 0.00001}, {delta, -0.823 - 0.01, -0.823 + 0....


2

Not certain this does what you need, but it may give you a way forward. Note, one can likely do this more economically, but I wanted to show all the pieces deliberately. Manipulate[ Module[{wAC, wAA, wBB, wBC}, wAC[a_, b_, c_, β_, p_, θA_, τ_, Fc_, bτ_] := Module[{πAC, dAC, csAC}, πAC = (((1 + β (1 - p)) (a - τ*θA)^2)/(4 (b + ...


2

This version recomputes f[a, x] when the y-range is changed f[a_, x_] := a Sin[x] {amin, amax} = {1, 2}; Manipulate[Plot[f[a, x], {x, 0, xmax}, PlotRange -> {{0, xmax}, {ymin = -ymax, ymax}}], {a, amin, amax}, {xmax, Pi, 2 Pi}, {ymax, 2, 6}] However, in this version the y-range is fixed ... f[a_, x_] := a Sin[x] {amin, amax} = {1, 2}; ymax = 2; ...


2

PrimePowerQ only takes exact numbers as arguments. In[1]:= PrimePowerQ[1.2] During evaluation of In[1]:= PrimePowerQ::exact: Argument 1.2` in PrimePowerQ is not an exact number. Out[1]= PrimePowerQ[1.2] Plot is happy to ignore the unevaluated Piecewise calls (which is why you also get the discontinuities). All three questions are fixed by replacing ...


2

Clear["Global`*"] U = f^α*c^(1 - α); Bcon = c - (T - f)*w; MRS = D[U, f]/D[U, c]; AbsSlpCon = D[Bcon, f]; TC = MRS - AbsSlpCon; sols = Solve[{TC == 0, Bcon == 0}, {f, c}]; {SuperStar[f], SuperStar[c]} = {f, c} /. Last[sols] // Simplify; c1[T_, w_] = c /. Solve[Bcon == 0, c]; U is not defined as a function (i.e, with arguments), so it cannot be ...


1

The problem is you are using a capital "P" for your function name. Please try payoff[x_,b_,c_] =-(c + 2 b (x - 1)) x; Plot[payoff[x, 4, 2], {x, 0, 1}, Axes -> False, Frame -> True]


1

Clear["Global`*"] f[a_, x_] := a + x^2; g[b_, x_] := b + x; intersect[a_, b_] := Module[ {sol = Solve[{f[a, x] == g[b, x], a >= 0, b >= 0, x >= 0}, x]}, If[sol === {}, {}, {x, f[a, x]} /. sol[[1]]]] Manipulate[Plot[Evaluate@{f[a, x], g[b, x]}, {x, 0, 50}, PlotLegends -> {Placed["Expressions", {0.7, 0.7}], Placed[...


1

ClearAll[reParametricListLinePlot]; reParametricListLinePlot[ ifs : {_InterpolatingFunction, _InterpolatingFunction}, opts : OptionsPattern@ListLinePlot] := ListLinePlot[Transpose[Re@#@"ValuesOnGrid" & /@ ifs], opts]; Manipulate[ reParametricListLinePlot[ NDSolveValue[ {a'[t] == -I*a[t] (delta + g*Re[b[t]]) - a[t]*0.04/2, ...


1

You might consider the following variant of cvgmtj's answer. It has some performance advantages. Manipulate[ {aF, adF, bF, bdF} = NDSolveValue[ {a'[t] == -I*a[t] (delta + g*Re[b[t]]) - a[t]*0.04/2, b'[t] == -I (b[t]*delta + g*Abs[a[t]]^2) - a[t]*0.09/2, a[0] == 1, b[0] == 1}, {a, a', b, b'}, {t, 0, 200}]; ParametricPlot[{Re[...


1

Clear["Global`*"] f[a_, x_] := a*Log[x]; fp[a_, x_] := a/x; g[b_, m_, x_] := b + m*x; Solve for intersect1 once rather than for each set of parameters. (*Intersection Point in bottom diagram*) intersect1[a_, b_, m_] = {x, fp[a, x]} /. Assuming[Thread[{a, b, m} > 0], Solve[{fp[a, x] == g[b, m, x], a > 0, b > 0, m > 0, x > 0}, ...


1

1. Define U and Bcon so that the parameters each depends on appear as arguments: ClearAll[U, Bcon, MRS, AbsSlpCon, f, c, α, T, w, sols, c1, c2, fcopt] U[f_, c_, α_] := f^α*c^(1 - α); Bcon[f_, c_, T_, w_] := c - (T - f)*w; MRS = D[U[f, c, α], f]/D[U[f, c, α], c]; AbsSlpCon = D[Bcon[f, c, T, w], f]; TC = MRS - AbsSlpCon; sols = Solve[{TC == 0, Bcon[f, c, ...


1

Clear["Global`*"] energy[c_, σ_, k_, Λ_, p2_, Δ_, Γ_] := c/(2 σ^2) - (k*Λ)^2/2*Δ/(Δ^2 + Γ^2/4)* p2*c - π (k*Λ)^2*Δ*σ^2*p2* PolyLog[2, -(c/(2*(Δ^2 + Γ^2/4)*π*σ^2))]; Manipulate[Column@{ Plot[FindMinimum[ {energy[7*10^6, σ, 8055*^3, 659176*^-10, p, Δ, 1], σ > 0}, {σ, 10^-6}][[1]], {p, 0, 10}, WorkingPrecision -...


1

It is bad practice and dangerous to use the same symbol name in the ODE and for the solution function. Anyway, with the code below you can play with your parameters. ClearAll[M, A, Ne, t] r = 0.2; Manipulate[ sol = NDSolve[{M'[t] == r*(M[t]*(1 - M[t]/1500) - eMA*M[t]*A[t]/1500 - eMN*M[t]*Ne[t]/1500), A'[t] == r*(A[t]*(1 - A[t]/1500)...


Only top voted, non community-wiki answers of a minimum length are eligible