Message Boards Message Boards

Define an implicit function?

Posted 6 years ago

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

POSTED BY: Christan Bauer
3 Replies

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 } *)
POSTED BY: Mariusz Iwaniuk
Posted 6 years ago

Sorry, I get the same error message as before when I use your first definition. Are there any options or packages to choose? I use 11.3.0 on a windows PC and started a new np file with this as the first line.

POSTED BY: Christan Bauer

I think you must already have given b a value. Try Clear[b], or, better, work in a fresh kernel.

POSTED BY: John Doty
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract