Solving expressions with indicator functions in wasora

7 views
Skip to first unread message

Ramiro Vignolo

unread,
Jul 13, 2019, 4:55:24 PM7/13/19
to was...@seamplex.com

Hi all,

How would you solve the following expressions within wasora’s framework:

M = \max_{0\leq t \leq T} S(t),
V = \mathbb{1}_{\{M > B\}} \quad \left(S(T) - K \right),

where T, K and B are fixed values, S(t) is a wasora function and \mathbb{1} is an indicator function that equals to one if the condition M > B is realized and zero otherwise. This condition checks if the function crosses the barrier level at some point in time between zero and T.

Let’s check out another case:

V = \mathbb{1}_{\{S(t) > B(t)\}} \quad \left(S(T) - K \right),

where we have substituted B with a wasora function B(t) and the condition must be checked in the same time interval as before, i.e., [0, T].

Other important cases are related to checks only in specific dates.

Finally, it is worth mentioning that I have already solved some cases but I would like to check out your ideas. Also, tricks using any kind of static or transient steps are not allowed.

As always, thanks a lot for reading and helping.

Rami

Jeremy Theler

unread,
Jul 17, 2019, 5:23:54 AM7/17/19
to was...@seamplex.com
Here is mine

S(t) := -t^3+t^2-t+1
B(t) := t-1
K = 2
T = 5
eps = 1e-4

M = S(func_min(-S(t), t, 0, T))
V = (integral(heaviside(S(t)>B(t)), t, 0, T)>eps)*(S(T)-K)

PRINT M V
--
You received this message because you are subscribed to the Google Groups "wasora" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wasora+un...@seamplex.com.
To view this discussion on the web visit https://groups.google.com/a/seamplex.com/d/msgid/wasora/CABqmneytKoHLgLYJCXMQmeex2ynbLM-uKSVM6Z1m6bMX%2BWoLrQ%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages