An open letter
- To: mathgroup at smc.vnet.net
- Subject: [mg16540] An open letter
- From: Jack Goldberg <jackgold at math.lsa.umich.edu>
- Date: Tue, 16 Mar 1999 04:00:16 -0500
- Sender: owner-wri-mathgroup at wolfram.com
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
- Follow-Ups:
- Re: An open letter
- From: Daniel Lichtblau <danl>
- Re: An open letter