Entity: MathLib 417 61 null * ix int 3 false false true iy int 3 false false true iz int 3 false false true Operation: pi MathLib double query static true result = 3.14159265 Operation: setSeeds MathLib void x int y int z int static true ix = x & iy = y & iz = z Operation: nrandom MathLib double query static true ix = ( ix@pre * 171 ) mod 30269 & iy = ( iy@pre * 172 ) mod 30307 & iz = ( iz@pre * 170 ) mod 30323 & result = ( ix / 30269.0 + iy / 30307.0 + iz / 30323.0 ) Operation: random MathLib double query static true r = MathLib.nrandom() & result = ( r - r.floor ) Operation: combinatorial MathLib int n int m int query static n >= m & m >= 0 ( n - m < m => result = Integer.Prd(m + 1,n,i,i) / Integer.Prd(1,n - m,j,j) ) & ( n - m >= m => result = Integer.Prd(n - m + 1,n,i,i) / Integer.Prd(1,m,j,j) ) Operation: factorial MathLib int x int query static true ( x < 2 => result = 1 ) & ( x >= 2 => result = Integer.Prd(2,x,i,i) ) Operation: gcd MathLib int x int y int query static x >= 1 & y >= 1 true Operation: lcm MathLib int x int y int query static x >= 1 & y >= 1 result = ( x * y ) / MathLib.gcd(x,y) Activity: MathLib gcd l : int ; k : int ; l := x ; k := y ; while l /= 0 & k /= 0 do if l < k then k := k mod l else l := l mod k ; if l = 0 then return k else return l ; return result Operation: integrate MathLib double f Sequence(double) d double query static f.size >= 1 & d >= 1 result = d*(f.subrange(2, f.size - 1)->sum()) + d*(f[1] + f.last)/2.0 Entity: Share 44 126 null * price double 3 false false false growth double 3 false false false variab double 3 false false false estimate double 3 false false false Entity: Sample 335 123 null * price double 3 false false false growth double 3 false false false variab double 3 false false false Association: Share Sample 1 216 133 339 126 0 samples null GeneralUseCase: estimateFuturePrice currentPrice double timeDays int growthRate double variation double runs int result double false Constraint: null true Share->isDeleted() & Sample->isDeleted() & MathLib.setSeeds(11007, 19122, 9997) null estimateFuturePrice false Constraint: null true Share->exists( s | s.price = currentPrice & s.growth = growthRate & s.variab = variation ) null estimateFuturePrice false Constraint: null true Integer.subrange(1,runs)->forAll( j | Sample->exists( s | s.price = price & s.growth = growth & s.variab = variab & s : samples ) ) Share estimateFuturePrice false Constraint: null true Integer.subrange(1,timeDays)->forAll( t | price = price@pre + price@pre * growth + price@pre * variab * MathLib.random() ) Sample estimateFuturePrice false Constraint: null true estimate = ( samples->collect(price)->sum() ) / runs Share estimateFuturePrice false Constraint: null true result = Share.estimate->any() null estimateFuturePrice false