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: [mg82155] Re: [mg82122] Re: What is the purpose of the Defer Command?
  • From: "Vincent N. Virgilio" <virgilio at ieee.org>
  • Date: Sat, 13 Oct 2007 03:57:03 -0400 (EDT)
  • References: <fe4uhp$155$1@smc.vnet.net> <fefhui$j6c$1@smc.vnet.net>

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
>


  • Prev by Date: Re: HELP: How to do count to the SUB-LIST
  • Next by Date: Re: ReplaceAll behavour
  • Previous by thread: Re: Re: What is the purpose of the Defer Command?
  • Next by thread: Re: Re: What is the purpose of the Defer Command?