MathGroup Archive 2009

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

Search the Archive

Re: Re: New free introductory book on Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg96510] Re: [mg96403] Re: New free introductory book on Mathematica
  • From: Leonid Shifrin <lshifr at gmail.com>
  • Date: Sun, 15 Feb 2009 03:20:50 -0500 (EST)
  • References: <gn11ht$834$1@smc.vnet.net> <200902130840.DAA26475@smc.vnet.net>

Dear Daniel,

Thanks a lot for your response!

Regarding the p.189, I think you are right in that my wording was not clear
enough. However, what I meant does not contradict your point: by "evaluated"
I meant not a complete evaluation but that all applicable rules associated
with a function were evaluated (used), which is true also  in your example:
the expression f[a] has been indeed rewritten into

(t=a^2;t=t+1)

Then, indeed, a normal evaluation process proceeds.

I will put a note on the bugs/typos page, until I change the wording in the
pdf and the web version (hopefully very soon) to be more clear on this.
Perhaps, I was a bit careless partly because I intended to give a much more
expanded discussion of evaluation in the part II of the book, which is not
yet finished.

Thanks again!

Regards,
Leonid

On Fri, Feb 13, 2009 at 12:40 AM, dh <dh at metrohm.com> wrote:

>
>
> Hi Leonid,
>
> I am just reading through your book. Thanks a lot for your contribution.
>
> Let me point out what I think is a small error. On page 189, concerning
>
> the Hold attribute of functions. The sentence:
>
> "We see that now the evaluation order  has changed : first the function
>
> < f > was evaluated,  and then the value of   < a > was  substituted"
>
> A held argument is substituted in the body of the function. But the body
>
> is then normally evaluated. That means as soon as the held attribute is
>
> encountered, it is replaced by its value. Here is an example:
>
>
>
> f[x_] := (
>
>    t = x^2;
>
>    t = t + 1
>
>    );
>
> SetAttributes[f, HoldAll];
>
> a = 4;
>
> f[q] // Trace
>
>
>
> regards, Daniel
>
>
>


  • Prev by Date: Re: Logarithmic Plot
  • Next by Date: Re: newbie here,, need help with parametrics
  • Previous by thread: Re: New free introductory book on Mathematica programming, and a
  • Next by thread: Re: NDSolve - Nice function but stiffness-problem