Re: variables versus functions
- To: mathgroup at smc.vnet.net
- Subject: [mg28808] Re: variables versus functions
- From: "Orestis Vantzos" <atelesforos at hotmail.com>
- Date: Mon, 14 May 2001 01:33:00 -0400 (EDT)
- Organization: National Technical University of Athens, Greece
- References: <9dld6m$o9g@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Well A=Cos[x] will always be the Cosinus of x, whereas A[x_]:=Cos[x] is the abstract concept of Cosinus, so that A[t]=Cos[t],A[2]=Cos[2] etc. FindRoot[A==B,...] would simply not work since A[x_]:=Cos[x] does not mess around with the symbol A itself (A will still evaluate to A, not Cos[...]). FindRoot[A[x]==B[x],{x,pi/2}] would work like a charm though...and so would FindRoot[A[t]==B[t],{t,pi/2}] which takes us back to your first question. Orestis PS. You can think of A=Cos[x] as an EXPRESSION (something that simply is), whereas A[x_]:=Cos[x] defines a FUNCTION (something that does something). "Julian Sweet" <jsweet at engineering.ucsb.edu> wrote in message news:9dld6m$o9g at smc.vnet.net... > How is it different to define a variable such as A=Cos[x] > versus a function A[x_]:=Cos[x] ? > > Furthermore, what If I define two functions A[x_]:=Cos[x] and > B[x_]=ArcTan[x]? How would FindRoot[A==B,{x,pi/2}] treat this > differently than if I just used variable definitions for A & B? > > > e-mail response appreciated: jsweet at engineering.ucsb.edu >