Wed Jun 11 18:30:05 MDT 1997 euler% math Mathematica 3.0 for Solaris Copyright 1988-96 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]:= (* ---------- Operators ---------- *) 0. Second In[6]:= f[x_]:= Exp[x] 0. Second In[7]:= g[x_]:= x^2 0. Second In[8]:= ff = Exp[#] & 0. Second Out[8]= Exp[#1] & In[9]:= gg = #^2 & 0. Second 2 Out[9]= #1 & In[10]:= (* (f + 2 g)(y) => e^y + 2 y^2 *) 0. Second In[11]:= (f + 2*g)[y] 0. Second Out[11]= (f + 2 g)[y] In[12]:= Through[%] 0.01 Second y Out[12]= E + (2 g)[y] In[13]:= (ff + 2*gg)[y] 0. Second 2 Out[13]= ((Exp[#1] & ) + 2 (#1 & ))[y] In[14]:= Through[%] 0.01 Second y 2 Out[14]= E + (2 (#1 & ))[y] In[15]:= (* (f o g)(y) => e^(y^2) *) 0. Second In[16]:= (f @ g)[y] 0. Second g Out[16]= (E )[y] In[17]:= Through[%] 0. Second 2 y Out[17]= E[y] In[18]:= (ff @ gg)[y] 0. Second 2 #1 & Out[18]= (E )[y] In[19]:= Through[%] 0. Second 2 y Out[19]= E[y] In[20]:= Clear[f, g, ff, gg] 0. Second In[21]:= (* Linear differential operator *) 0.01 Second In[22]:= OperatorRule = (n_Integer*Identity)[e_] -> n*e 0. Second Out[22]= (Identity (n_Integer))[e_] -> e n In[23]:= L = Composition[D[#, x]& - Identity, D[#, x]& + 2*Identity] 0. Second Out[23]= Composition[-Identity + (D[#1, x] & ), 2 Identity + (D[#1, x] & )] In[24]:= (* => f'' + f' - 2 f *) 0. Second In[25]:= L[f[x]] 0. Second Out[25]= (-Identity + (D[#1, x] & ))[(2 Identity + (D[#1, x] & ))[f[x]]] In[26]:= Through[Map[Through, %] /. OperatorRule] /. OperatorRule 0. Second Out[26]= -2 f[x] + f'[x] + f''[x] In[27]:= (* => g''(y) + g'(y) - 2 g(y) *) 0. Second In[28]:= (L /. x -> y)[g[y]] 0. Second Out[28]= (-Identity + (D[#1, y] & ))[(2 Identity + (D[#1, y] & ))[g[y]]] In[29]:= Through[Map[Through, %] /. OperatorRule] /. OperatorRule 0. Second Out[29]= -2 g[y] + g'[y] + g''[y] In[30]:= (* => 2 A [(1 + z) cos(z^2) - (1 + 2 z^2) sin(z^2)] *) 0. Second In[31]:= (L /. x -> z)[A * Sin[z^2]] 0. Second 2 Out[31]= (-Identity + (D[#1, z] & ))[(2 Identity + (D[#1, z] & ))[A Sin[z ]]] In[32]:= Through[Map[Through, %] /. OperatorRule] /. OperatorRule 0. Second 2 2 2 2 2 Out[32]= 2 A Cos[z ] + 2 A z Cos[z ] - 2 A Sin[z ] - 4 A z Sin[z ] In[33]:= (* Truncated Taylor series operator *) 0. Second In[34]:= T = Sum[(D[#1, {#2, k}] /. #2 -> #3)/k! * (#2 - #3)^k, {k, 0, 2}] & 0. Second k (D[#1, {#2, k}] /. #2 -> #3) (#2 - #3) Out[34]= Sum[---------------------------------------, {k, 0, 2}] & k! In[35]:= (* => f(a) + f'(a) (x - a) + f''(a) (x - a)^2/2 *) 0. Second In[36]:= T[f[x], x, a] 0. Second 2 (-a + x) f''[a] Out[36]= f[a] + (-a + x) f'[a] + ---------------- 2 In[37]:= (* => g(b) + g'(b) (y - b) + g''(b) (y - b)^2/2 *) 0. Second In[38]:= T[g[y], y, b] 0. Second 2 (-b + y) g''[b] Out[38]= g[b] + (-b + y) g'[b] + ---------------- 2 In[39]:= (* => sin(c) + cos(c) (z - c) - sin(c) (z - c)^2/2 *) 0. Second In[40]:= T[Sin[z], z, c] 0. Second 2 (-c + z) Sin[c] Out[40]= (-c + z) Cos[c] + Sin[c] - ---------------- 2 In[41]:= Clear[L, T] 0. Second In[42]:= (* Define the binary infix operator ~ so that x ~ y => sqrt(x^2 +\ > y^2) *) 0. Second In[43]:= x_ \[Tilde] y_:= Sqrt[x^2 + y^2]; 0. Second In[44]:= 3 \[Tilde] 4 0. Second Out[44]= 5 In[45]:= (* Make it associative: 3 ~ 4 ~ 12 => 13 *) 0. Second In[46]:= 3 \[Tilde] 4 \[Tilde] 12 0. Second Out[46]= 3 ~ 4 ~ 12 In[47]:= x_ \[Tilde] y_ \[Tilde] z_:= (x \[Tilde] y) \[Tilde] z; 0. Second In[48]:= 3 \[Tilde] 4 \[Tilde] 12 0. Second Out[48]= 13 In[49]:= (* Define the matchfix pair of operators | and | so that | x | =>\ > abs(x) *) 0. Second In[50]:= (* ---------- Quit ---------- *) 0. Second In[51]:= Quit[] real 3.91 user 0.80 sys 0.44