Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*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 2006

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

Search the Archive

Re: problems with sum functions/ factoring the factorial-> I got it to work!

  • To: mathgroup at smc.vnet.net
  • Subject: [mg65878] Re: problems with sum functions/ factoring the factorial-> I got it to work!
  • From: Roger Bagula <rlbagulatftn at yahoo.com>
  • Date: Thu, 20 Apr 2006 05:15:07 -0400 (EDT)
  • References: <e1sns1$86r$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

For those of you thought this too hard to reply to ...
The second Sum just makes it too long for Mathematica.
I instead used the exponential complex type Identities
which involved only ddoing the sum twice and reduced the
number of terms summed.
The Conpositorial type harmonic sine cosine functions gives a neat loop!
It is a truely new set of functions;
  unknown until now, I think.

Mathematica:
Çlear[f, g, cf, p]
f[n_] := If[PrimeQ[n] == True, 1, n]
cf[0] = 1;
cf[n_Integer?Positive] := cf[n] = f[n]*cf[n - 1]
g[n_] := If[PrimeQ[n] == True, n, 1]
p[0] = 1;
p[n_Integer?Positive] := p[n] = g[n]*p[n - 1]
Clear[Ce, Pe, Ce1, Pe1]
Ce[x_] := 1 + NSum[p[n]*x^n/n!, {n, 1, 25}];
Pe[x_] := 1 + NSum[cf[n]*x^n/n!, {n, 1, 25}];
CSin[x_] := Re[(Ce[I*x] - Ce[-I*x])/(2*I)]
PSin[x_] := Re[(Pe[I*x] - Pe[-I*x])/(2*I)]
CCos[x_] := Re[(Ce[I*x] + Ce[-I*x])/(2)]
PCos[x_] := Re[(Pe[I*x] + Pe[-I*x])/(2)]
Plot[CSin[x], {x, -Pi, Pi}, Axes -> False]
Plot[CCos[x], {x, -Pi, Pi}, Axes -> False]
Plot[PSin[x], {x, -Pi, Pi, Axes -> False}]
Plot[PCos[x], {x, -Pi, Pi, Axes -> False}]
g1 = ParametricPlot[{CSin[x], CCos[x]}, {x, -Pi, Pi}, Axes -> False]
g2 = ParametricPlot[{PSin[x], PCos[x]}, {x, -Pi, Pi}, Axes -> False]
Show[{g1, g2}]
Roger Bagula wrote:

> I have no problem constructing the Primorial or Compositorial functions 
> that factor the factorial as:
> cf[n]*p[n]=n!
> But trying to get the sine and cosine constructed functions to plot
> seems to be a problem here:
> Clear[f, g, cf, p, CeS, CeC, PeS, PeC]
> f[n_] := If[PrimeQ[n] == True, 1, n]
> cf[0] = 1;
> cf[n_Integer?Positive] := cf[n] = f[n]*cf[n - 1]
> g[n_] := If[PrimeQ[n] == True, n, 1]
> p[0] = 1;
> p[n_Integer?Positive] := p[n] = g[n]*p[n - 1]
> Ce = 1 + Sum[1/cf[n], {n, 1, 1000}];
> N[%, 100]
> Pe = 1 + Sum[1/p[n], {n, 1, 1000}];
> N[%, 100]
> CeS[x_] := 1 + NSum[(-1)^n*p[2*n + 1]*x^(2*n + 1)/(2*n + 1)!, {n, 1, 100}];
> CeC[x_] := 1 + NSum[(-1)^n*p[2*n]*x^(2*n)/(2*n)!, {n, 1, 100}];
> ParametricPlot[{CeC[x], CeS[x]}, {x, 0, 2*Pi}]
> PeS[x_] := 1 + NSum[(-1)^n*cf[2*n + 1]*x^(2*n + 1)/(2*n + 1)!, {n, 1, 100}];
> PeC[x_] := 1 + NSum[(-1)^n*cf[2*n]*x^(2*n)/(2*n)!, {n, 1, 100}];
> ParametricPlot[{PeC[x], PeS[x]}, {x, 0, 2*Pi}]
> 
> Alernative functions:
> CeS1[x_] := 1 + NSum[(-1)^n*x^(2*n + 1)/cf[2*n + 1], {n, 1, 100}];
> CeC1[x_] := 1 + NSum[(-1)^n*x^(2*n)/cf[2*n], {n, 1, 100}];
> ParametricPlot[{CeC[x], CeS[x]}, {x, 0, 2*Pi}]
> PeS1[x_] := 1 + NSum[(-1)^n*x^(2*n + 1)/p[2*n + 1], {n, 1, 100}];
> PeC1[x_] := 1 + NSum[(-1)^n*x^(2*n)/p[2*n], {n, 1, 100}];
> ParametricPlot[{PeC1[x], PeS1[x]}, {x, 0, 2*Pi}]
> 
> In addition this function seem to come up with the wrong sign:
> Pe[x_] := 1 + NSum[cf[n]*x^n/n!, {n, 1, 100}];
> Plot[Pe[x], {x, 0, 5}]
> 
> Or alternatively:
> Pe1[x_] := 1 + NSum[x^n/p[n], {n, 1, 100}];
> Plot[Pe1[x], {x, 0, 5}]
> 
> Ce*Pe~ 5*E (low)
> Roger
> 


  • Prev by Date: Re: What is Infinity+Pi*I
  • Next by Date: Re: Re: Named Formats? (followup question)
  • Previous by thread: Re: 3 transcendent equations, 2 unknown variables
  • Next by thread: Re: Re: Named Formats? (followup question)