Question: Summation procedure involving multiplication and lists

Hi everyone again

This one is linked to my previous 2 question.

Essentially I am trying to use a procedure to reproduce the formula:

S(j) = (1 + sum(H_j*T_j,j=1..n))/(1 + sum(1/(H_j*T_j),j=1..n))

BigProc:= proc(H::list,T::list)
local Form, i;
Form:=[];
for i from 1 to nops(H) do
Form := [op(Form),(1 + [sum(H[1..i]*~T[1..i],i=1..5)])/~(1 + [sum(1/~(H[1..i]*~T[1..i]),i=1..5)])]
end do:
end proc:
MainProc([1,3,5],[3,6,8])

Error, (in sum) summation variable previously assigned, second argument evaluates to 1 = 1 .. 5
 

The actual answer should be (3, 396/25,22320/509)

ie 

S(1) = (1+ 3)/(1+(1/3)) = 3

S(2) = (1 +(3+18))/(1+1/3 + 1/18)) = 396/25

S(3) = (1 +(3+18+40))/(1+1/3 + 1/18 +1/40) = 22320/509

I feel like I am missing a few things to my procedure. Any help would be greatly appreciated!

Please Wait...