# Soft Recurrence as an arguments of the Min()

Hi all,

Recursive computing is one of the strong properties of QM. However, I found that the Min() function incorrectly makes calculations, if its arguments are recursive expressions. If this is a bug in the program code, it would be nice to have the development team took care of it. If this is not an error code, then what has been done wrong in the attached model. Your valuable explanations are very welcome.

SAU,

I would say this is a bug. I’ve also tested this using the Max Function and the same results. I’ve tried multiplying by 1 the soft recursion (M1::B[~PREV]*1) no success. Even checking the help file it states:

Soft Recurrence

You can force a calculation of an item, when no previous or next value exists, by using a soft recurrence formula. You create a soft recurrence by adding a tilde (~) in front of the keyword, e.g. [~PREV]. [b:1c0ybdzy]Quantrix will assume a value of zero when calculating the first or next item[/b:1c0ybdzy].

I logged an IDBS case in 2016 and after 19 months of silence was finally told of a workaround for this bug. It’s a hack, but it works. I’m posting it here publicly in case anyone else runs into this problem.

In a formula min(3.35, B1:Month[~PREV] + 0.5), in the first Month, the bug causes the min function to fail completely, such that the result is 3.35 , when in fact the formula should evaluate as min(3.35, 0 + 0.5) = 0.5

The workaround provided by IDBS is to modify the formula to:

min(3.35, if(isblank(B1:Month[~PREV])=1,0.5,B1:Month[~PREV] + 0.5))

In other words, use a if(isblank()) test to separate the first Month from the remaining months. This defeats the whole point of using an ~ to write a single *elegant* formula covering an entire series.