Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: What is the purpose of the Defer Command?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg82196] Re: [mg82122] Re: What is the purpose of the Defer Command?
  • From: DrMajorBob <drmajorbob at bigfoot.com>
  • Date: Sun, 14 Oct 2007 06:17:04 -0400 (EDT)
  • References: <fe4uhp$155$1@smc.vnet.net> <fefhui$j6c$1@smc.vnet.net> <1721082.1192176923906.JavaMail.root@m35> <op.tz3l3cbhqu6oor@monster.gateway.2wire.net> <7189487.1192239221818.JavaMail.root@m35>
  • Reply-to: drmajorbob at bigfoot.com

> That is, I can integrate one of the output cells in your Defer example by
> adding "Evaluatable" to its properties.

That has nothing to do with Defer; you're talking about CellPrint, and I 
see no advantage to CellPrint over Print. Evaluate the Help example, and 
now you'll see not five integrals, but 10, and they won't even be in a  
sensible order (1, 1, 2, 3, 4, 5, 2, 3, 4, 5 at my machine). Evaluate it 
again and you have 15 output cells, and again they're in no useful order.  
Using Print, you have 5 outputs no matter how many times you evaluate it,  
and they're in the proper order.

And... changing the properties of a cell is more transparent for newbies 
than using First to remove Defer or ReleaseHold to remove HoldForm, or  
simply copy/paste from an earlier line? I don't think so.

I also see no reason to involve copy/paste in the use of Defer... no more  
so than any other wrapper, anyway. First or Defer->Identity removes the 

wrapper. Use Defer the first time the expression is formed (and save it),  
and no copy/paste will be required.

I'm not sure Defer does anything HoldForm doesn't do... but I can type it  
faster, and I can type First faster than I can type ReleaseHold.

Bobby

On Fri, 12 Oct 2007 15:48:43 -0500, Vincent N. Virgilio  
<virgilio at ieee.org> wrote:

> Nice.
>
> However, I'll hazard more opinion.
>
> Your first example with HoldForm always requires ReleaseHold to integrate
> any of the expressions in the output cells. Your second example with  
> Defer
> can be integrated differently, perhaps in a way more appropriate for a
> tutorial or help page, e.g. ". . . Perform the computation yourself  
> before
> evaluating the following cells . . .".
>
> That is, I can integrate one of the output cells in your Defer example by
> adding "Evaluatable" to its properties. I cannot do so with your HoldForm
> example, which requires ReleaseHold. Both the Evaluatable property and
> ReleaseHold can be programmed into document/cell creation, but I think 
> the
> Evaluatable property is more transparent. Someone new to Mathematica
> learning about, say, integrals, would probably be distracted by postfix
> ReleaseHolds. Moreover, those ReleaseHolds make document creation more
> complex (though, since this is software, anything is possible).
>
> Vince Virgilio
>
>
> On 10/12/07, DrMajorBob <drmajorbob at bigfoot.com> wrote:
>>
>> How about this?
>>
>> Function[{n},
>>    Print[save[n] = HoldForm[Integrate[x^n Exp[-x], {x, 0, 1}]]]] /@
>>   Range[5];
>>
>> That gives the same outputs as the Defer example and it allows, for
>> instance,
>>
>> save[3] // ReleaseHold
>>
>> 6 - 16/\[ExponentialE]
>>
>> We can use Defer almost the same way, however:
>>
>> Function[{n},
>>    Print[save[n] = Defer[Integrate[x^n Exp[-x], {x, 0, 1}]]]] /@
>>   Range[5];
>>
>> First@save[3]
>>
>> 6 - 16/\[ExponentialE]
>>
>> Bobby
>>
>> On Fri, 12 Oct 2007 02:04:49 -0500, Vince Virgilio <blueschi at gmail.com>
>> wrote:
>>
>> > On Oct 9, 5:34 am, "David Park" <djmp... at comcast.net> wrote:
>> >> Still, my question is: "What is the purpose of the Defer Command?"
>> >>
>> >> The only potential purpose that I can see is for didactic purposes,
>> to
>> >> show
>> >> preliminary expressions before they are automatically evaluated. But
>> the
>> >> only way to get Defer to evaluate is by copying and pasting and then
>> >> evaluating,  by using Shift-Ctrl-L and then evaluating, or by
>> >> evaluating in
>> >> place. All of these operations leave no record of the steps taken.  
>> That
>> >> goes
>> >> contrary to any didactic purpose.
>> >>
>> >> --
>> >> David Park
>> >> djmp... at comcast.nethttp://home.comcast.net/~djmpark/
>> >
>> > Have you noticed the example in the documentation (http://
>> > reference.wolfram.com/mathematica/ref/Defer.html) that uses Defer to
>> > create cells with unevaluated contents? That has didactic potential.
>> >
>> > Can that example be rewritten without Defer, with similar complexity?
>> >
>> > Vince Virgilio
>> >
>> >
>> >
>>
>>
>>
>> --
>> DrMajorBob at bigfoot.com
>>



-- 

DrMajorBob at bigfoot.com


  • Prev by Date: Re: Evaluation question
  • Next by Date: Re: "dereference" variable
  • Previous by thread: Re: Re: What is the purpose of the Defer Command?
  • Next by thread: Mouse cursor properties