Hello,
I would like to convert the following Scilab code that I generated into Fortran 95, but not entirely sure of how to deal with it. Two issues, one how to deal with an equivalent to linspace and secondly the recursive function in zeta_3.
// Riemann Zeta Function (all domains)
// Re > 1 function s=zeta_1(z,n) n=linspace(1,n,n); //s=0.0; if z == 0 s = -0.5 elseif z == 1 s = %inf else s=sum(n.^-z); end
endfunction
// Re < 0 function zfn = zeta_2(s,n) // Riemann's functional equation // Analytic contiuation for negative values zfn = 2.s .* %pi.(s - 1) .* sin(%pi.s./2) . gamma(1 - s) .* zeta_1((1 - s),n) endfunction
// 0 < Re < 1
function zs1 = zeta_3(s,n)
// Vectorised version
zs1=0
k=linspace(1,n,n);
zs1 = sum((-1).^(k+ 1)./(k.s ));
zs1 = 1./(1 - 2.( 1-s )).*zs1;
endfunction
Any suggestions would be most helpful. Thanks
Lester