Re: A Use for Interpretation

*To*: mathgroup at smc.vnet.net*Subject*: [mg85754] Re: A Use for Interpretation*From*: David Bailey <dave at Remove_Thisdbailey.co.uk>*Date*: Thu, 21 Feb 2008 17:57:20 -0500 (EST)*References*: <200802190700.CAA27893@smc.vnet.net> <fphcts$8ij$1@smc.vnet.net>

Murray Eisenberg wrote: > Very nice! Some other places where this might be employed are in laws > of exponents or laws of logs. Or applying trig identities. Or Laplace > transform. > > Ideally, this could be used not just by the teacher, but by the student > who would demonstrate that she knows the rules by "teaching them to the > computer". Yet there's a "catch" to that: the Mathematica > sophistication needed, what with ReplaceRepeated, RuleDelayed, HoldForm, > ReleaseHold, and FreeQ. Not to mention the "strange" definition of the > function, like "integrate" here, which must be defined in terms of itself. > > David Park wrote: >> Since Version 6 appeared and I first encountered Interpretation I found it >> rather difficult to understand what use it might have. The examples in Help >> seem almost bizarre. >> >> Here is one use where it works rather well. Teachers might often be >> frustrated in demonstrating the behavior of basic function such as D, >> Integrate or Limit because Mathematica automatically evaluates using its >> built-in rules. With Interpretation we can define a pseudo routine that >> displays as the real routine and then apply our own basic transformation >> rules. Here is an example with a linear breakout of Integrate. >> >> integrate[integrand_, var_] := >> Interpretation[HoldForm[Integrate[integrand, var]], >> integrate[integrand, var]] >> >> We then define rules that breakout sums and constant factors. The rules even >> display in a nice form. >> >> rule1 = integrate[a_ + b_, x_] -> integrate[a, x] + integrate[b, x] >> rule2 = integrate[a_?(FreeQ[#, x] &) b_, x_] -> a integrate[b, x] >> >> Then we can demonstrate how these rules work, performing the actual >> integration in the last step. >> >> integrate[5 a Sin[x] + y Cos[x] + x^2, x] >> % //. rule1 >> % //. rule2 >> % /. Interpretation[a_, b_] :> ReleaseHold[a] >> > I think there is a better way to do this. I use Inert[Integrate]Sin[x],{x,0,Pi}] and use a MakeBoxes rule to display the result as a grey-shaded integral. The advantage of this method is that it is possible to edit the contents of the inert integral and re-input the result. David Bailey http://www.dbaileyconsultancy.co.uk

**Follow-Ups**:**Re: Re: A Use for Interpretation***From:*Murray Eisenberg <murray@math.umass.edu>

**References**:**A Use for Interpretation***From:*"David Park" <djmpark@comcast.net>