I have defined a function g
as
g[t_] := (
res = 0;
i = 1;
While[i <= t,
res = res + i;
i = i + 1;
];
res);
The aim is to work with the function F[u]
, which should be a the integral of g
in bounds $[0,u]$, something like
F[u_] := Integrate[g[y], {y, 0, u}]
However, the result I obtain for F
is not correct with such definition of g
. In fact, F
takes value 0 for any argument u
(my guess is that this happens because g[y]
is immediately evaluated as 0).
How can F
be redefined properly, without changing the definition of g
?