Wed Mar 24 19:48:50 MST 1999 euler% math Mathematica 3.0 for Solaris Copyright 1988-97 Wolfram Research, Inc. -- Terminal graphics initialized -- In[1]:= In[2]:= In[3]:= (* ----------[ M a t h e m a t i c a ]---------- *) 0. Second In[4]:= (* ---------- Initialization ---------- *) 0. Second In[5]:= (* ---------- Series ---------- *) 0. Second In[6]:= (* Taylor series---this first example comes from special relativity => 1 + 1/2 (v/c)^2 + 3/8 (v/c)^4 + 5/16 (v/c)^6 + O((v/c)^8) *) 0. Second In[7]:= 1/Sqrt[1 - (v/c)^2] 0. Second 1 Out[7]= ------------ 2 v Sqrt[1 - --] 2 c In[8]:= Series[%, {v, 0, 7}] 0.15 Second 2 4 6 v 3 v 5 v 8 Out[8]= 1 + ---- + ---- + ----- + O[v] 2 4 6 2 c 8 c 16 c In[9]:= 1/%^2 0. Second 2 v 8 Out[9]= 1 - -- + O[v] 2 c In[10]:= (* Note: sin(x) = x - x^3/6 + x^5/120 - x^7/5040 + O(x^9) cos(x) = 1 - x^2/2 + x^4/24 - x^6/720 + O(x^8) tan(x) = x + x^3/3 + 2/15 x^5 + 17/315 x^7 + O(x^9) *) 0. Second In[11]:= tsin = Series[Sin[x], {x, 0, 7}] 0. Second 3 5 7 x x x 8 Out[11]= x - -- + --- - ---- + O[x] 6 120 5040 In[12]:= tcos = Series[Cos[x], {x, 0, 7}] 0. Second 2 4 6 x x x 8 Out[12]= 1 - -- + -- - --- + O[x] 2 24 720 In[13]:= (* Note that additional terms will be computed as needed *) 0. Second In[14]:= tsin/tcos 0.01 Second 3 5 7 x 2 x 17 x 8 Out[14]= x + -- + ---- + ----- + O[x] 3 15 315 In[15]:= Series[Tan[x], {x, 0, 7}] 0.01 Second 3 5 7 x 2 x 17 x 8 Out[15]= x + -- + ---- + ----- + O[x] 3 15 315 In[16]:= Clear[tsin, tcos] 0. Second In[17]:= (* => -x^2/6 - x^4/180 - x^6/2835 - O(x^8) *) 0. Second In[18]:= Series[Log[Sin[x]/x], {x, 0, 7}] 0.01 Second 2 4 6 -x x x 8 Out[18]= --- - --- - ---- + O[x] 6 180 2835 In[19]:= Series[Sin[x]/x, {x, 0, 7}] 0.01 Second 2 4 6 x x x 8 Out[19]= 1 - -- + --- - ---- + O[x] 6 120 5040 In[20]:= Series[Log[%], {x, 0, 7}] 0. Second 2 4 6 -x x x 8 Out[20]= --- - --- - ---- + O[x] 6 180 2835 In[21]:= (* => [a f'(a d) + g(b d) + integrate(h(c y), y = 0..d)] + [a^2 f''(a d) + b g'(b d) + h(c d)] (x - d) *) 0. Second In[22]:= D[f[a*x], x] + g[b*x] + Integrate[h[c*y], {y, 0, x}] 0.65 Second Out[22]= g[b x] + Integrate[h[c y], {y, 0, x}] + a f'[a x] In[23]:= Series[%, {x, d, 1}] 0.08 Second Out[23]= (g[b d] + Integrate[h[c y], {y, 0, d}] + a f'[a d]) + 2 2 > (h[c d] + b g'[b d] + a f''[a d]) (-d + x) + O[-d + x] In[24]:= (* Taylor series of nonscalar objects (noncommutative multiplication) => (B A - A B) t^2/2 + O(t^3) [Stanly Steinberg] *) 0. Second In[25]:= (*declare([A, B], nonscalar)*) 0. Second In[26]:= E^((A + B)*t) - E^(A*t) * E^(B*t) 0. Second (A + B) t A t + B t Out[26]= E - E In[27]:= Simplify[%] 0.07 Second Out[27]= 0 In[28]:= Series[E^((A + B)*t) - E^(A*t) * E^(B*t), {t, 0, 3}] 0. Second 4 Out[28]= O[t] In[29]:= (* Laurent series: => sum( Bernoulli[k]/k! x^(k - 2), k = 1..infinity ) = 1/x^2 - 1/(2 x) + 1/12 - x^2/720 + x^4/30240 + O(x^6) [Levinson and Redheffer, p. 173] *) 0. Second In[30]:= Series[1/(x*(Exp[x] - 1)), {x, 0, 6}] 0.02 Second 2 4 6 -2 1 1 x x x 7 Out[30]= x - --- + -- - --- + ----- - ------- + O[x] 2 x 12 720 30240 1209600 In[31]:= (* Puiseux series (terms with fractional degree): => 1/sqrt(x - 3/2 pi) + (x - 3/2 pi)^(3/2) / 12 + O([x - 3/2 pi]^(7/2)) *) 0. Second In[32]:= Series[Sqrt[Sec[x]], {x, 3/2*Pi, 3}] 0.01 Second -3 Pi 3/2 (----- + x) 1 2 -3 Pi 7/2 Out[32]= --------------- + -------------- + O[----- + x] -3 Pi 12 2 Sqrt[----- + x] 2 In[33]:= (* Generalized Taylor series => sum( [x log x]^k/k!, k = 0..infinity\ > ) *) 0. Second In[34]:= Series[x^x, {x, 0, 3}] 0. Second 2 2 3 3 Log[x] x Log[x] x 4 Out[34]= 1 + Log[x] x + ---------- + ---------- + O[x] 2 6 In[35]:= (* Compare the generalized Taylor series of two different\ > formulations of a function => log(z) + log(cosh(w)) + tanh(w) z + O(z^2) *) 0. Second In[36]:= s1 = Series[Log[Sinh[z]] + Log[Cosh[z + w]], {z, 0, 1}] 0.01 Second 2 Out[36]= (Log[z] + Log[Cosh[w]]) + Tanh[w] z + O[z] In[37]:= s2 = Series[Log[Sinh[z] * Cosh[z + w]], {z, 0, 1}] 0.02 Second 2 Out[37]= (Log[z] + Log[Cosh[w]]) + Tanh[w] z + O[z] In[38]:= Simplify[s1 - s2] 0. Second 2 Out[38]= O[z] In[39]:= Clear[s1, s2] 0. Second In[40]:= (* Look at the generalized Taylor series around x = 1 => (x - 1)^a/e^b [1 - (a + 2 b) (x - 1) / 2 + O((x - 1)^2)] *) 0. Second In[41]:= Log[x]^a*Exp[-b*x] 0. Second a Log[x] Out[41]= ------- b x E In[42]:= Series[%, {x, 1, 1}] 0.01 Second a Log[x] Out[42]= Series[-------, {x, 1, 1}] b x E In[43]:= (* Asymptotic expansions => sqrt(2) x + O(1/x) *) 0. Second In[44]:= Series[Sqrt[2*x^2 + 1], {x, Infinity, 0}] 0.02 Second 1 Out[44]= Sqrt[2] x + O[-] x In[45]:= (* Wallis' product => 1/sqrt(pi n) + ... [Knopp, p. 385] *) 0. Second In[46]:= Series[1/2^(2*n) * Binomial[2*n, n], {n, Infinity, 0}] Series::esss: Essential singularity encountered in -2 Log[2] 2 Exp[--------- + O[Series`n] ]. Series`n Series::esss: Essential singularity encountered in -2 Log[2] 2 Exp[--------- + O[Series`n] ]. Series`n Series::esss: Essential singularity encountered in -2 Log[2] 2 Exp[--------- + O[Series`n] ]. Series`n General::stop: Further output of Series::esss will be suppressed during this calculation. 0.08 Second Binomial[2 n, n] Out[46]= Series[----------------, {n, \[Infinity], 0}] 2 n 2 In[47]:= (* => 0!/x - 1!/x^2 + 2!/x^3 - 3!/x^4 + O(1/x^5) [Knopp, p. 544] *) 0. Second In[48]:= Exp[x] * Integrate[Exp[-t]/t, {t, x, Infinity}] 0.65 Second x 1 Out[48]= E If[x > 0, Gamma[0, x], Integrate[----, {t, x, \[Infinity]}]] t E t In[49]:= Series[%, {x, Infinity, 5}] 0.01 Second x Out[49]= Series[E If[x > 0, Gamma[0, x], 1 > Integrate[----, {t, x, \[Infinity]}]], {x, \[Infinity], 5}] t E t In[50]:= (* Multivariate Taylor series expansion => 1 - (x^2 + 2 x y + y^2)/2\ > + O(x^4) *) 0. Second In[51]:= Series[Cos[x + y], {x, 0, 2}, {y, 0, 2}] 0.02 Second 2 2 y 3 3 1 y 3 2 3 Out[51]= 1 - -- + O[y] + (-y + O[y] ) x + (-(-) + -- + O[y] ) x + O[x] 2 2 4 In[52]:= (* Power series (compute the general formula) *) 0. Second In[53]:= << DiscreteMath`RSolve` 2.08 Second In[54]:= SeriesTerm[Log[Sin[x]/x], {x, 0, n}] 0.57 Second -1 + n I (2 I) BernoulliB[n] Out[54]= If[n == 0, 0, (--------------------------- + n! -1 + n n I (2 I) BernoulliB[n, 1] (2 I) BernoulliB[1 + n] > ------------------------------ + ------------------------ - n! (1 + n)! n (2 I) BernoulliB[1 + n, 1] > ---------------------------) / n] (1 + n)! In[55]:= Apply[Plus, Table[%*x^n, {n, 0, 7}]] 0.01 Second 2 4 6 -x x x Out[55]= --- - --- - ---- 6 180 2835 In[56]:= SeriesTerm[Sin[x]*Exp[-x], {x, 0, n}] 0.2 Second I n I n - (-1 - I) - (-1 + I) 2 2 Out[56]= ----------- - ----------- n! n! In[57]:= Apply[Plus, Table[%*x^n, {n, 0, 7}]] 0. Second 3 5 6 7 2 x x x x Out[57]= x - x + -- - -- + -- - --- 3 30 90 630 In[58]:= (* Derive an explicit Taylor series solution of y as a function of x\ > from the following implicit relation: y = x - 1 + (x - 1)^2/2 + 2/3 (x - 1)^3 + (x - 1)^4 + 17/10 (x - 1)^5 +\ > ... *) 0. Second In[59]:= x == Sin[y] + Cos[y] 0. Second Out[59]= x == Cos[y] + Sin[y] In[60]:= Series[%[[2]], {y, 0, 5}] 0.01 Second 2 3 4 5 y y y y 6 Out[60]= 1 + y - -- - -- + -- + --- + O[y] 2 6 24 120 In[61]:= InverseSeries[%, x] 0.05 Second 2 3 5 (-1 + x) 2 (-1 + x) 4 17 (-1 + x) Out[61]= (-1 + x) + --------- + ----------- + (-1 + x) + ------------ + 2 3 10 6 > O[-1 + x] In[62]:= (* Pade (rational function) approximation => (2 - x)/(2 + x) *) 0. Second In[63]:= << Calculus`Pade` 0.09 Second In[64]:= Pade[Exp[-x], {x, 0, 1, 1}] 0.01 Second x 1 - - 2 Out[64]= ----- x 1 + - 2 In[65]:= (* Fourier series of f(x) of period 2 p over the interval [-p, p] => - (2 p / pi) sum( (-1)^n sin(n pi x / p) / n, n = 1..infinity ) *) 0. Second In[66]:= << Calculus`FourierTransform` 5.49 Second In[67]:= FourierTrigSeries[x, {x, -p, p}, 5] 2.67 Second Pi x 2 Pi x 3 Pi x 4 Pi x 2 p Sin[----] p Sin[------] 2 p Sin[------] p Sin[------] p p p p Out[67]= ------------- - ------------- + --------------- - ------------- + Pi Pi 3 Pi 2 Pi 5 Pi x 2 p Sin[------] p > --------------- 5 Pi In[68]:= (* => p / 2 - (2 p / pi^2) sum( [1 - (-1)^n] cos(n pi x / p) / n^2, n = 1..infinity )\ > *) 0. Second In[69]:= s = FourierTrigSeries[Abs[x], {x, -p, p}, 5] 15.09 Second Pi x 2 2 2 2 4 Cos[----] Sqrt[Im[p] + Re[p] ] Sqrt[Im[p] + Re[p] ] p Out[69]= --------------------- - --------------------------------- - 2 2 Pi 3 Pi x 2 2 5 Pi x 2 2 4 Cos[------] Sqrt[Im[p] + Re[p] ] 4 Cos[------] Sqrt[Im[p] + Re[p] ] p p > ----------------------------------- - ----------------------------------- 2 2 9 Pi 25 Pi In[70]:= ComplexExpand[%] 0.09 Second 2 Pi x 2 3 Pi x 2 4 Sqrt[p ] Cos[----] 4 Sqrt[p ] Cos[------] Sqrt[p ] p p Out[70]= -------- - -------------------- - ---------------------- - 2 2 2 Pi 9 Pi 2 5 Pi x 4 Sqrt[p ] Cos[------] p > ---------------------- 2 25 Pi In[71]:= p/: Re[p] = p 0. Second Out[71]= p In[72]:= p/: Im[p] = 0 0. Second Out[72]= 0 In[73]:= s 0.01 Second 2 Pi x 2 3 Pi x 2 4 Sqrt[p ] Cos[----] 4 Sqrt[p ] Cos[------] Sqrt[p ] p p Out[73]= -------- - -------------------- - ---------------------- - 2 2 2 Pi 9 Pi 2 5 Pi x 4 Sqrt[p ] Cos[------] p > ---------------------- 2 25 Pi In[74]:= PowerExpand[%] 0. Second Pi x 3 Pi x 5 Pi x 4 p Cos[----] 4 p Cos[------] 4 p Cos[------] p p p p Out[74]= - - ------------- - --------------- - --------------- 2 2 2 2 Pi 9 Pi 25 Pi In[75]:= Clear[p, s] 0. Second In[76]:= (* ---------- Quit ---------- *) 0. Second In[77]:= Quit[] real 60.41 user 29.05 sys 0.63