Re: Re: A Use for Interpretation

• To: mathgroup at smc.vnet.net
• Subject: [mg85811] Re: [mg85754] Re: A Use for Interpretation
• From: Murray Eisenberg <murray at math.umass.edu>
• Date: Sat, 23 Feb 2008 04:23:59 -0500 (EST)
• Organization: Mathematics & Statistics, Univ. of Mass./Amherst
• References: <200802190700.CAA27893@smc.vnet.net> <fphcts\$8ij\$1@smc.vnet.net> <200802212257.RAA18187@smc.vnet.net>

```What's "Inert"?  Nothing in Documentation Center about it that I see!

David Bailey wrote:
> 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
>

--
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305

```

• Prev by Date: Re: Re: "Assuming"
• Next by Date: Re: Constraint visualization
• Previous by thread: Re: A Use for Interpretation
• Next by thread: Re: [functional approach should give] an even faster way