-- | -- Theta-functions implemented on top of trigonometric series.---- Theta-functions are special functions of several complex variables-- Their importance is that we can construct an elliptic functions from-- combination of theta-functions, see details at-- <http://en.wikipedia.org/wiki/Theta_function>.---- Depend on parameter Tau, which should be positive.-- Call every function in the following form:---- @theta1 N (qpar Tau) U@---- where @N@ is a number of addends in series representing the function, -- @Tau@ is a tau parameter defining the theta-function and-- @U@ is an argument, which is a complex number.---- WARNING: theta-functions are raising their values very quickly when arg is raising. -- This depends on behaviour of cos and sin of complex functions, -- which are very rapidly increasing their values.-- Call theta-functions with n < 20, q < 1, |u| < pi.moduleNumeric.Functions.Theta(qpar,theta1,theta2,theta3,theta4)where-- We work with complex numbers onlyimportData.Complex-- And we have exceptional situationsimportControl.Exception-- | \Theta_1theta1::(RealFloata)=>Integer->Complexa->Complexa->Complexatheta1nqu=(*2).sum$map(theta1_argqu)[0..n]theta1_arg::(RealFloata)=>Complexa->Complexa->Integer->Complexatheta1_argqunn=(signfunnn)*(qfun2qnn)*(sinfunu(2*nn+1))-- | \Theta_2theta2::(RealFloata)=>Integer->Complexa->Complexa->Complexatheta2nqu=(*2).sum$map(theta2_argqu)[0..n]theta2_arg::(RealFloata)=>Complexa->Complexa->Integer->Complexatheta2_argqunn=(qfun2qnn)*(cosfunu(2*nn+1))-- | \Theta_3theta3::(RealFloata)=>Integer->Complexa->Complexa->Complexatheta3nqu=(+1).(*2).sum$map(theta3_argqu)[1..n]theta3_arg::(RealFloata)=>Complexa->Complexa->Integer->Complexatheta3_argqunn=(qfun1qnn)*(cosfunu(2*nn))-- | \Theta_4theta4::(RealFloata)=>Integer->Complexa->Complexa->Complexatheta4nqu=(+1).(*2).sum$map(theta4_argqu)[1..n]theta4_arg::(RealFloata)=>Complexa->Complexa->Integer->Complexatheta4_argqunn=(signfunnn)*(qfun1qnn)*(cosfunu(2*nn))-- | Theta-function depends on parameter q, which abs should be lower than 1-- Parameter q, however, depends on the main parameter tau, -- so we will make q dependent variableqpar::RealFloata=>a->Complexaqpartau|tau>0=exp$(pi:+0)*(0:+tau)*(0:+1)|otherwise=throw$ErrorCall"tau should be > 0 !"-- | Complex signum function.-- Equivalent to raising (-1) to the power of nsignfun::(RealFloata)=>Integer->Complexasignfunnn|oddnn=((-1):+0)|otherwise=(1:+0)-- | Sine function tailored for our typessinfun::(RealFloata)=>Complexa->Integer->Complexasinfunun=sin$u*fromIntegern-- | Helper included in mathematical definition of 'theta1' and 'theta2'.qfun2::(RealFloata)=>Complexa->Integer->Complexaqfun2qn=q**(0.5+fromIntegern)**2-- | Cosine function tailored for our typescosfun::(RealFloata)=>Complexa->Integer->Complexacosfunun=cos$u*fromIntegern-- | Helper included in mathematical definition of 'theta3' and 'theta4'.qfun1::(RealFloata)=>Complexa->Integer->Complexaqfun1qn=q**(fromIntegern)**2