Re: An open letter
- To: mathgroup at smc.vnet.net
- Subject: [mg16617] Re: An open letter
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Fri, 19 Mar 1999 12:53:47 -0500
- Organization: University of Western Australia
- References: <7cleqb$9oh@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Jack Goldberg wrote: > My main purpose in using Mathematica is help students learn mathematics. > So for my purposes the fact that Mathematica evaluates everything in sight > is a major drawback. Let me be explicit. I want to illustrate > "Integration by Parts". So I try to define > > ByParts[Integrate[f_*g_,x_],g_] := ???? > > What I would like as an output of ByParts is this > > Integrate[f*g,x] == f*Integrate[g,x] - > Integrate[D[f,x]*Integrate[g,x],x] > > where the integration on the left IS NOT performed, the integration of > g in the two integrals on the right is performed but the last integral > on the right is unevaluated. Put in other words, I would like Mathematica to > display the kind of formula the student would get using integration by > parts. My suggestion would to be not use Integrate, e.g., In[1]:= ByParts[integrate[f_*g_, x_], g_] := integrate[f*g, x] == f*integrate[g, x] - integrate[D[f, x]*integrate[g, x], x] In[2]:= ByParts[integrate[x*Sin[x], x], x] Out[2]= integrate[x*Sin[x], x] == integrate[x, x]*Sin[x] - integrate[Cos[x]*integrate[x, x], x] To check the solution: In[3]:= % /. integrate -> Integrate Out[3]= Sin[x] - x*Cos[x] == 1/2*Sin[x]*x^2 + 1/2*(-2*x*Cos[x] - (x^2 - 2)*Sin[x]) In[4]:= FullSimplify[%] Out[4]= True You might want to have a look at the "Step-by-Step Differentiation" example. To go directly to this example, simple execute the following cell: FrontEndExecute[ FrontEnd`HelpBrowserLookup["GettingStarted", "Step-by-Step Differentiation"]] > Now back to my open letter. This example is only one of three or > four that I have fell prey to. All of them are based on Mathematica's propensity > to evaluate. I offer only one more example and I will be brief > in my description. > > I want to explain why e^x*e^x = e^(2x) by using > the power series expansion of e^x. I > define the Cauchy product of series for the students and would like > Mathematica to exhibit the nth coefficient of the product as a finite sum. > > Sum[ x^n/n!, {n,0,Infinity} ]*Sum[ x^n/n!, {n,0,Infinity} ] == > Sum[ Sum[ 1/(k!(n-k)!, {k,0,n}] x^n, {n,0,Infinity} ] Although there does exist a package for such manipulations, to compute the general term of a sum, I prefer to work with the _general_ term of a sum (effectively using the Einstein summation convention) and pattern-matching. My reasons for this are (1) this is a useful abstraction for students to learn; (2) it is effectively what a human does; (3) the summation symbols and associated indices are just dummy placeholders. Here are the steps for your example: In[1]:= x^n/n! x^m/m! /. n -> n - m (series re-arrangement by pattern-matching) In[2]:= Sum[%, {m, 0, n}]; In[3]:= Sum[%, {n, 0, Infinity}] Out[3]= E^(2*x) This approach is completely general and can be used to generate the recurrence relations for differential equations, etc. Cheers, Paul ____________________________________________________________________ Paul Abbott Phone: +61-8-9380-2734 Department of Physics Fax: +61-8-9380-1014 The University of Western Australia Nedlands WA 6907 mailto:paul at physics.uwa.edu.au AUSTRALIA http://www.physics.uwa.edu.au/~paul God IS a weakly left-handed dice player ____________________________________________________________________