Mon Mar 31 15:26:48 MST 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]:= (* ---------- Partial Differential Equations ---------- *) 0. Second In[6]:= (* This is the heat equation *) 0. Second In[7]:= heat = D[u[x, t], t] - D[u[x, t], {x, 2}] == 0 0. Second (0,1) (2,0) Out[7]= u [x, t] - u [x, t] == 0 In[8]:= (* This is the similarity form of the proposed solution *) 0. Second In[9]:= s = f[x/Sqrt[t]]/Sqrt[t] 0. Second x f[-------] Sqrt[t] Out[9]= ---------- Sqrt[t] In[10]:= (* Substitute s into the heat equation *) 0. Second In[11]:= heat /. u -> Apply[Function, {{x, t}, s}] 0.01 Second x x x -f[-------] x f'[-------] f''[-------] Sqrt[t] Sqrt[t] Sqrt[t] Out[11]= ----------- - ------------- - ------------ == 0 3/2 2 3/2 2 t 2 t t In[12]:= ( (* Change to the similarity variable z = x/sqrt(t) *) % /. x -> z*Sqrt[t] ) 0. Second -f[z] z f'[z] f''[z] Out[12]= ------ - ------- - ------ == 0 3/2 3/2 3/2 2 t 2 t t In[13]:= ( (* Combine over a common denominator *) Map[Together, %] ) 0.01 Second -f[z] - z f'[z] - 2 f''[z] Out[13]= -------------------------- == 0 3/2 2 t In[14]:= ( (* Eliminate the denominator *) %[[1]] * Denominator[%[[1]]] == 0 ) 0.01 Second Out[14]= -f[z] - z f'[z] - 2 f''[z] == 0 In[15]:= ( (* Now, solve the ordinary differential equation *) sol = DSolve[%, f[z], z] ) 0.41 Second 2 Sqrt[z ] C[2] Erfi[--------] C[1] 2 Out[15]= {{f[z] -> ----- + -------------------}} 2 2 z /4 z /4 E E In[16]:= (* Finally, transform back to the original variables *) 0. Second In[17]:= Clear[s] 0. Second In[18]:= s -> sol[[1,1,2]]/Sqrt[t] /. z -> x/Sqrt[t] 0. Second 2 x Sqrt[--] t C[2] Erfi[--------] C[1] 2 --------- + ------------------- 2 2 x /(4 t) x /(4 t) E E Out[18]= s -> ------------------------------- Sqrt[t] In[19]:= ( (* If we set C[1] = 1/(2 sqrt(pi)) and C[2] = 0 in the previous\ > expression, we will obtain the usual fundamental solution of the heat equation *) % /. {C[1] -> 1/(2*Sqrt[Pi]), C[2] -> 0} ) 0.01 Second 1 Out[19]= s -> ---------------------------- 2 x /(4 t) 2 E Sqrt[Pi] Sqrt[t] In[20]:= (* ---------- Quit ---------- *) 0. Second In[21]:= Quit[] real 1.74 user 1.13 sys 0.34