Question: How to use 'sum' on functions?

 

 

I have defined a function G, which has only one input parameter. I'm excuting following code.

sum(G(13-j), j = 0 .. 2)

with debug swiching on for 'sum' and 'G'. I got following error message:

-----------------------------------------------------------------------------------------------------------------------

{--> enter G, args = `+`(13, `-`(j))

<-- ERROR in G (now at top level) = final value in for loop must be numeric or character}
Error, (in G) final value in for loop must be numeric or character
 

-----------------------------------------------------------------------------------------------------------------------

It seems that function sum does not pass the value of j to the function G.

Please Wait...