problems with sum functions/ factoring the factorial
- To: mathgroup at smc.vnet.net
- Subject: [mg65698] problems with sum functions/ factoring the factorial
- From: Roger Bagula <rlbagulatftn at yahoo.com>
- Date: Sun, 16 Apr 2006 01:44:55 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
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