[Date Index]
[Thread Index]
[Author Index]
Re: Fine control of evaluation
*To*: mathgroup at smc.vnet.net
*Subject*: [mg126460] Re: Fine control of evaluation
*From*: Brentt <brenttnewman at gmail.com>
*Date*: Sat, 12 May 2012 04:53:50 -0400 (EDT)
*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com
*References*: <13064693.4533.1336710718460.JavaMail.root@m06>
Thank you. I didn't know about the presentations package. Neat.
On Fri, May 11, 2012 at 9:09 AM, djmpark <djmpark at comcast.net> wrote:
> This is easy using either the EvaluateAt or EvaluateAtPattern functions in
> the Presentations Application.
>
> << Presentations`
>
> func1[x_] := f[x];
> func2[x_] := g[x];
>
> HoldForm[func1[x] + func2[x]]
> % // EvaluateAt[{1, 1}]
>
> func1[x] + func2[x]
> f[x] + func2[x]
>
> HoldForm[func1[x] + func2[x]]
> % // EvaluateAtPattern[_func1]
>
> func1[x] + func2[x]
> f[x] + func2[x]
>
>
> David Park
> djmpark at comcast.net
> http://home.comcast.net/~djmpark/index.html
>
>
> From: Brentt [mailto:brenttnewman at gmail.com]
>
>
> Hello, I am struggling with evaluation control and was hoping someone might
> point me in the right direction. I vaguely remember seeing something in the
> manual or the tutorials addressing this issue, but I can't find the section
> I saw it in.
>
> How does one get fine control over things wrapped in Hold and HoldForm. Say
> I have some functions
>
> func1[x_]:= f[x];
> func2[x_] := g[x];
> step1 = HoldForm[ func1[x]+ func2[x] ];
>
> Now say I want the statements wrapped in HoldForm, func1[x]+ func2[x] to
> evaluate to f[x]+ func2[x]
>
> I thought naturally it would be something like
>
> step2 = HoldForm[ Evaluate[func1[x]]+ func2[x] ] ;
>
> But then HoldForm seems a bit overzealous about it's task, and outputs
> Evaluate[func1[x]]+ func2[x]---it leaves Evaluate unevaluated. (I tried
> wrapping it func1[x] in ReleaseHold to no avail.)
>
> The above is just pseudocode, Maybe there is some specifics about what I
> was
> actually doing that was causing the unintuitive behavior (i.e. HoldForm
> holding Evaluate, instead of, well, evaluating.) What I was doing was more
> along these lines:
> ----------------
> ubounds= {u,0, pi};
> vbounds={v,0,2pi};
> t[dir_]:= D[s[u,v],dir_]; (*where dir_ is going to be either u or v*)
>
> (*here is the difficult part:*)
> formattedOutput= Integrate[HoldForm[t[u]] , ubounds, vbounds ]
> //TraditionalForm;
> ----------------
> The issue is that I want the t[u] wrapped in the HoldForm to evaluate to
> D[s[u,v],dir_], and hold that. If I wrap it in Evaluate, HoldForm holds
> Evaluate (puzzling), and tries to integrate Evaluate as if it is the
> integrand. I've tried all kinds of permutations of HoldForm, Defer,
> ReleaseHold, Evaluate, and I haven't had anything to work.
>
> Thank you for any help or pointing me in the right direction
>
>
Prev by Date:
**Re: Fine control of evaluation**
Next by Date:
**Re: question: fitting a distribution from quantiles**
Previous by thread:
**Re: Fine control of evaluation**
Next by thread:
** speeding up intergration of sum**
| |