Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: pair sums applied to trignometry sums

  • To: mathgroup at smc.vnet.net
  • Subject: [mg52505] Re: [mg52487] pair sums applied to trignometry sums
  • From: Daniel Lichtblau <danl at wolfram.com>
  • Date: Tue, 30 Nov 2004 05:24:10 -0500 (EST)
  • References: <200411290622.BAA27977@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Roger Bagula wrote:
> I had used the mechanism with Bailey type of sequences
> and their sums in the work on b normalness in iteratives functions.
> 
> It occurred to me that by adding the variable x , I could get
> functiond that used the nonlinear Cantor pair {1/(n+1),n/(n+1)}
> to split the sine and the cosine down the middle.
> The result is entirely new trignometric sum functions that converge very 
> well.
> 
> (* pair sums applied to trignometry sums: {1/(n+1),n/(n+1)} modulo 2 
> switched sums*)
> (* these sums break the trignometry of a circle into four functions 
> instead of two*)
> (* these are subharmonic functions of a nonlinear Rational Cantor type*)
> fs[x_,n_]:=
>   If[Mod[n,2]==1,(-1)^(n)*n*x^(2*n+1)/((n+1)*(2*n+1)!),(-1)^(n)*
>       x^(2*n+1)/((n+1)*(2*n+1)!)]
> 
> 
> gs[x_,n_]:=
>   If[Mod[n,2]==1,(-1)^n*x^(2*n+1)/((n+1)*(2*n+1)!),(-1)^n*n*
>       x^(2*n+1)/((n+1)*(2*n+1)!)]
> 
> 
> fc[x_,n_]:=
>   If[Mod[n,2]==1,(-1)^(n)*n*x^(2*n)/((n+1)*(2*n)!),(-1)^(n)*
>       x^(2*n)/((n+1)*(2*n)!)]
> 
> 
> gc[x_,n_]:=
>   If[Mod[n,2]==1,(-1)^(n)*x^(2*n)/((n+1)*(2*n)!),(-1)^(n)*n*
>       x^(2*n)/((n+1)*(2*n)!)]
> 
> digits=100;
> 
> 
> fsin[x_]:=N[Sum[fs[x,n],{n,0,digits}]];
> 
> 
> gsin[x_]:=N[Sum[gs[x,n],{n,0,digits}]]
> 
> 
> fcos[x_]:=N[Sum[fc[x,n],{n,0,digits}]]
> 
> 
> gcos[x_]:=N[Sum[gc[x,n],{n,0,digits}]]
> 
> 
> Plot[fsin[x],{x,-Pi,Pi}]
> 
> Plot[fsin[x],{x,-Pi,Pi}]
> 
> 
> Plot[gsin[x],{x,-Pi,Pi}]
> 
> 
> Plot[fcos[x],{x,-Pi,Pi}]
> 
> 
> Plot[gcos[x],{x,-Pi,Pi}]
> 
> 
> Plot[(fsin[x]+gsin[x]),{x,-Pi,Pi},PlotRange->All]
> 
> 
> Plot[(fcos[x]+gcos[x]),{x,-Pi,Pi}]
> 
> 
> ParametricPlot[{fsin[x],gsin[x]},{x,-Pi,Pi}]
> 
> ParametricPlot[{fcos[x],gcos[x]},{x,-Pi,Pi}]
> 
> ParametricPlot[{fsin[x],fcos[x]},{x,-Pi,Pi}]
> 
> ParametricPlot[{gsin[x],gcos[x]},{x,-Pi,Pi}]
> 
> ParametricPlot[{fsin[x]+gsin[x],fcos[x]+gcos[x]},{x,-Pi,Pi},PlotRange->All]
> Respectfully, Roger L. Bagula
> 
> tftn at earthlink.net, 11759Waterhill Road, Lakeside,Ca 92040-2905,tel: 619-5610814 :
> alternative email: rlbtftn at netscape.net
> URL :  http://home.earthlink.net/~tftn


It occurs to me that these functions might be simplified, as they are 
each themselves sums of pairs of functions with terms satisfying simple 
recurrences. For example, fs can be written as the sum of n-even + n-odd 
terms, and these are just the sums of terms 1/(2*k+1)*x^(4*k+1)/(4*k+1)!
and (-1)*(2*k+1)/(2*k+2)*x^(4*k+3)/(4*k+3)! respectively.

In more detail we get the function below.

InputForm[fsin2[x_] = Together[-Sum[(2*k+1)/(2*k+2)*x^(4*k+3)/(4*k+3)!, 
{k,0,Infinity}] +
   Sum[1/(2*k+1)*x^(4*k+1)/(4*k+1)!, {k,0,Infinity}]]]

Out[10]//InputForm= (-4 + 4*Cosh[x] + x*Sin[x] - x*Sinh[x])/(2*x)

(Isn't it great to have a symbolic math engine at ones fingertips?)

As a quick check:

In[11]:= InputForm[Max[Abs[Table[fsin2[x]-fsin[x], {x,-Pi,Pi,.1}]]]]
Out[11]//InputForm= 3.372302437298913*^-15

(Isn't it great to have a numeric math engine at ones fingertips?)

The advantage to using the closed form is twofold. One is that numeric 
computations are better, and the other is that they are significantly 
faster. To see the latter:

In[5]:= Timing[Plot[fsin[x],{x,-Pi,Pi}]]
Out[5]= {0.3 Second, -Graphics-}

In[6]:= Timing[Plot[fsin2[x],{x,-Pi,Pi}]]
Out[6]= {0.01 Second, -Graphics-}

For the former, just notice what happens when we get outside the range 
-Pi<x<Pi, for example the interval {15*Pi,16*Pi}.


Daniel Lichtblau
Wolfram Research



  • Prev by Date: Re: Re;Re; Speeding Up Indexing andJoining
  • Next by Date: New User - Programming
  • Previous by thread: pair sums applied to trignometry sums
  • Next by thread: Re: []Speeding Up Indexing and Joining