# Define an implicit function?

Posted 10 days ago
154 Views
|
3 Replies
|
4 Total Likes
|
 Hi there, I have a theoretic decision model that involves a number of equations that cannot be solved in a closed form, i.e. the solution is given only implicitely. The first of these functions then enters another equaition, that again can only be solved implicitely. And encounter problems when I try to implement this. I only need a numerical solution, as it is for illustration prupose only. Now here's the first equation: b[x_] := Solve[b == x - 0.1*Quantile[NormalDistribution[0, 1], b], b] which gives the error message \$RecursionLimit::reclim2: Recursion depth of 1024 exceeded during evaluation of -0.1 Quantile[NormalDistribution,b]. I'd prefer to have the 0.1 as a free parameter "b[x,s] :=...", but would be able to live with that if I have to. Any ideas or comments? Best Christian
3 Replies
Sort By:
Posted 10 days ago
 Maybe so: ClearAll["Global*"]; Remove["Global*"];(* Clears the kernel *) . b[x_] := FindRoot[b == x - 1/10*Quantile[NormalDistribution[0, 1], b][[1]], {b, 1/2}] b[0.1] (* {b -> 0.188386} *) b[2] (* Give error messages because, InverseErfc[x] exist only for 0 < x < 2*) Func[x_, μ_, σ_, s_] := FindRoot[b == x - s*Quantile[NormalDistribution[μ, σ], b][[1]], {b, 1/10}] Func[0.1, 0, 1, 1/10] (* {b -> 0.188386} *) Another way: f[b_?NumericQ, μ_?NumericQ, σ_?NumericQ, s_?NumericQ] := s*Quantile[NormalDistribution[μ, σ], b] x = 0.1; μ = 0; σ = 1; s = 1/10; NMinimize[{1, -b + x - f[b, μ, σ, s] == 0}, b, Method -> "RandomSearch"][[2]] // Quiet (* {b -> 0.188386 } *) 
 I think you must already have given b a value. Try Clear[b], or, better, work in a fresh kernel.