For a simulation, there's an equation that (in part) takes the form of

0.3.(t mod(T + 1))−(t mod(10)).sin(t/pi)

where t reflects a time period of T, and T reflects the total number of periods. Let's simulate part of it really fast.
Code:
clear

set obs 100 // 100 units

qui g id = _n // our ID

expand 2000 // 2000 time periods

qbys id: g time = _n // 1...2000
The outcome is where I'm having trouble. I recognize the "mod" as the modulo operator. But I'm curious how we'd implement this mathematically in Stata.

More concretely, does this mean we'd do
Code:
su time, mean

loc max = r(max)+1

qbys id: g y = 0.3 * mod(time,`max') - ///
mod(time,10)*sin(time/_pi)
When I see t mod(T+1), it seems like it implies multiplication, but that doesn't make any sense. Does my code here seem like the right way to think about this?