Re: An open letter
- To: mathgroup at smc.vnet.net
- Subject: [mg16820] Re: An open letter
- From: "David Bailey" <dave-bailey at freeuk.com>
- Date: Tue, 30 Mar 1999 02:35:20 -0500
- References: <7cleqb$9oh@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
I know exactly what you mean. The answer is to define new operations that imply integration but which are not recognised explicitly by mathematica (I call this oprtation Integral). Please look at my company's web site at www.salford-software.com/mathematica for more details of a package which provides inert integrals as part of a larger package which enables users to specify arbitrary mathematical transformations using colour. (My work address id db at salford-software.com). In my experience, HoldForm/Hold/HoldAll is not the best answer to this sort of problem because it is so hard to write code so that Mathematica NEVER gets the chance to jump in and do an evaluation that you do not want! David Bailey Jack Goldberg wrote in message <7cleqb$9oh at smc.vnet.net>... >Hi Group, > >I am a Mathematica enthusiast who has dabbled in programming >Mathematica for enough years that I feel free to complain. Here's >my gripe: > >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. I have found this surprisingly difficult to do. I have used >various combinations of Evaluate, Hold, HoldFirst and HoldForm with >only partial success. I have gotten to the point where I don't even >understand why my last effort failed! Perhaps someone could explain why >the following does not work. > >ByParts[ f_*g_,x_,g_] := Module[ {int, dif, li1}, > int = Integrate[g,x]; > dif = D[f,x]; > li1 = int*dif; > HoldForm[Integrate[f*g,x]] == f*int- > HoldForm[Integrate[li1,x]] > ] > >(I hope I have the right number of left and right brackets!) >The problem is that the very last HoldForm seems to prevent >li1 from providing int*dif as the integrand. What's going on? > >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} ] > >There is not a single term in this expression that Mathematica will leave >unevaluated! I could trick Mathematica by inserting spurious factors that >would stop the evaluation process, but I don't want to have to figure >out some clever way to do this or to introduce holds etc. > >I am fairly confident that this type of problem can be solved by >a judicious combination of "holds" and "releaseholds" and "evaluates". >The fact remains that it is something of a challange. It shouldn't >be. I say this because at least one other CAS has an easy means for >accomplishing this goal. > >What say yo'all? > >Jack > > >