# [✓]  First passage time distribution with moving boundary

Posted 11 months ago
822 Views
|
4 Replies
|
4 Total Likes
|
 Hello everyone! I'd like to investigate a first passage problem with moving boundary. I'm not good in Wolfram Mathematica and I don't see how I can modify this code (from Mathematica Help, but I'm interested not only in Wiener process) sample = Map[FirstCase[#, _?(Last[#] >= 2 &)] &, RandomFunction[WienerProcess[1, 1], {0, 15, 0.01}, 10^4]["Paths"]]; data0 = DeleteCases[sample, {}][[All, 1]]; data = Cases[data0, _?Positive]; Show[Histogram[data, 30, "PDF"]] I want to replace "2" in the first code line to some function f(t)f(t) and I understand I've got to calculate the boundary at times f(ti)f(ti) and then check the condition X(ti)⩾f(ti)X(ti)⩾f(ti) and if it's true, titi is a hitting time for this trajectory, but what should I do in code?Thanks for help and I'm sorry for bad English.
Answer
4 Replies
Sort By:
Posted 11 months ago
 Dear Anonymous (nice name!),Can you explain what you want more clearly? I am not sure I understand. If you want to change the threshold to some f[t]^2, you can do that with: ff[t_] := 2 + .1*t sample = Map[FirstCase[#, _?(Last[#] >= ff[First[#]]^2 &)] &, RandomFunction[WienerProcess[1, 1], {0, 15, 0.01}, 5]["Paths"]] (shown for 5 paths instead of 10^4). I do not understand why you have f(t)f(t) and titi-- do you mean f(t)^2 and ti^2 or are those typos? Above I assumed you meant f(t)^2. What is X(ti)? I don't understand how you want to use this X(ti)>=f(ti)X(ti)>=f(ti)
Answer
Posted 11 months ago
 Oh, sorry, I copied my question from another site (and there I used TeX). I mean I want to find a first passage time distribution with moving boundary (and boundary is some function $f(t)$) and I don't know how to do it. In example from help $f(t)$ is just a constant "2", but I want, for example, $a + \sqrt t$. And I understand I've got to calculate boundary at each step $f({t_i})$ and if at some step stochastic process $X({t_i}) > f({t_i})$ then $f({t_i})$ is a hitting time.
Answer
Posted 11 months ago
 I think this is what you want ff[t_] := 2 + Sqrt[t] sample = Map[FirstCase[#, _?(Last[#] >= ff[First[#]] &)] &, RandomFunction[WienerProcess[1, 1], {0, 15, 0.01}, 500]["Paths"]] data0 = DeleteCases[sample, Missing[_]][[All, 1]] data = Cases[data0, _?Positive]; Histogram[data, 30, "PDF"] Regards
Answer
Posted 11 months ago
 Thank you, it works!
Answer
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments