[Date Index]
[Thread Index]
[Author Index]
Re: Sin*Cos + Log
*To*: mathgroup at smc.vnet.net
*Subject*: [mg113315] Re: Sin*Cos + Log
*From*: Norbert Marxer <marxer at mec.li>
*Date*: Sat, 23 Oct 2010 07:06:13 -0400 (EDT)
*References*: <i9m83i$jeu$1@smc.vnet.net>
On Oct 20, 10:09 am, Sam Takoy <sam.ta... at yahoo.com> wrote:
> Dear Bob,
>
> Thanks.
>
> My hope is that I can define f without mentioning the arguments, as in
>
> f = Sin*Cos + Log
>
> It doesn't make much difference in this case, but in my case I have something
> along the lines of
>
> f[t_, x_, y_, z_] = g[t, x, y, z]*h[t, x, y, z] + Derivative[0, 0, 1, 0][h][t,
> x, y, z] etc
>
> and I'd like to say
>
> f = g*h + Derivative[0, 0, 1, 0][h]
>
> skipping the arguments.
>
> Is that possible?
>
> Thanks!
>
> Sam
>
> ________________________________
> From: Bob Hanlon <hanl... at cox.net>
> To: Sam Takoy <sam.ta... at yahoo.com>; mathgr... at smc.vnet.net
> Sent: Tue, October 19, 2010 7:20:45 AM
> Subject: Re: Sin*Cos + Log
>
> f[x_?NumericQ] := Sin[x]*Cos[x] + Log[x]
>
> f /@ {x, 2, 2.}
>
> {f[x], Log[2] + Cos[2] Sin[2], 0.314746}
>
> x /: NumericQ[x] = True;
>
> f /@ {x, y}
>
> {Log[x] + Cos[x] Sin[x], f[y]}
>
> Bob Hanlon
>
> ---- Sam Takoy <sam.ta... at yahoo.com> wrote:
>
> =============
> Hi,
>
> I'm working on a project that involves manipulating lots of functions.
> It would be much easier if I could manipulate functions without
> evaluating them and then evaluate them at the end. To this end, is there
> a way to endow
>
> f = Sin*Cos + Log
>
> with meaning and then somehow evaluate
>
> f[x]?
>
> Many thanks in advance,
>
> Sam
Hello
I think that you have to specify the functions which will use your
arguments. Note that f = Sin*Cos + Log (see FullForm) also contains
the function Plus, and I'm sure your argument(s) should not be used
there.
But you could use something like that:
f := Sin[##] Cos[##] + Log[##] &
and f[x] will give you
Log[x] + Cos[x] Sin[x]
Or
f := g[##]*h[##] + Derivative[0, 0, 1, 0][h][##] &
and f[t,x,y,z] will give you
g[t, x, y, z]*h[t, x, y, z] + Derivative[0, 0, 1, 0][h][t, x, y,
z]
I hope this helps.
Best Regards
Norbert Marxer
Prev by Date:
**Re: FunctionQ?**
Next by Date:
**Suggestions for improving speed**
Previous by thread:
**Re: Sin*Cos + Log**
Next by thread:
**Locator Manipulate**
| |