Two cents worth on two queries

*To*: mathgroup at yoda.physics.unc.edu*Subject*: Two cents worth on two queries*From*: fulling at sarastro.tamu.edu (Stephen A. Fulling)*Date*: Tue, 7 Jul 92 15:22:43 CDT

Keywords: Logarithm, Simplification rule, Differential equation, Legendre polynomial I. Hassan Saleh <salehh at jacobs.cs.orst.edu> writes: %Mathematica does not support the solutions of differential equations %of the form % % g (x)f'' + g (x)f' + a f = 0 % 2 n 1 n n n % %particularly Legendre differential equations even though orthogonal %polynomials are built into the kernel. Is there any particular reason %for this ? Not every 2nd-order linear ODE can be solved in closed form. It's probably a bit much to expect Mathematica to recognize all those that can be -- especially if the definition of "can be" changes whenever a new special function is added elsewhere in the database. Consider, for instance, that changes of variables can produce an endless variety of equivalent, solvable equations. Recent issues of Journal of Symbolic Computation show that solvability of differential equations within given algebras of functions is a topic of ongoing research. Programming even the classical lore contained in books like G. M. Murphy, _Ordinary Differential Equations and Their Solutions_, would make for a substantial Mma add-on product, I think. II. Keith Clay <clay at galileo.phys.washington.edu> writes: %A few of us have noticed tha Mathematica is at a loss for %simplifying even the simplest functions involving logarithms.... % %... it doesn't seem to know that Log[1/a_]:=-Log[a]. You can %Unprotect Log and tell it this, but why do we have to? I once listened in on a conversation with a WRI expert concerning this problem. (The principals are free to identify themselves and speak for themselves if they wish.) The key point is that there is no uniquely best "canonical form" for expressions involving logarithms. Sometimes one wants to rewrite Log[a] + Log[b] as Log[a*b], but sometimes one needs to do the reverse. An automatic simplification rule would make one transformation or the other impossible -- by immediately reversing it. However, you can define a transformation rule and use it when you need it: In[1]:= Log[(x^2+1)/(x+1)] 2 1 + x Out[1]= Log[------] 1 + x In[2]:= LogProductRule = {Log[x_ y_] -> Log[x] + Log[y]} Out[2]= {Log[(x_) (y_)] -> Log[x] + Log[y]} In[3]:= %1 /. LogProductRule 1 2 Out[3]= Log[-----] + Log[1 + x ] 1 + x You can also have an InverseLogProductRule to go in the other direction. It is not necessary to unprotect Log here -- no more than you need to unprotect Plus in order to use /. a+b -> 2 to simplify an expression when you know that a + b happens to equal 2 in your problem. S. A. Fulling Math, Texas A&M U.