       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
> (* 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
>
> alternative email: rlbtftn at netscape.net

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//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:= InputForm[Max[Abs[Table[fsin2[x]-fsin[x], {x,-Pi,Pi,.1}]]]]
Out//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:= Timing[Plot[fsin[x],{x,-Pi,Pi}]]
Out= {0.3 Second, -Graphics-}

In:= Timing[Plot[fsin2[x],{x,-Pi,Pi}]]
Out= {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