MathGroup Archive 2001

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

Search the Archive

Re: Re:How to define a polyfunction?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg27426] Re: Re:How to define a polyfunction?
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Sun, 25 Feb 2001 00:53:54 -0500 (EST)
  • References: <974vp8$6jh@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

An addition to my earlier posting.

The earlier ways allow changes in golf to to affect Key, they also carry the
penalty that golf must be differentiated each time that Key is evaluated.
The following does the differentiation in setting the definition for Key,
but subsequent changes to golf will have no effect

Clear["`*"]
t=3;
golf:=t^2-t;
Block[{ t},Key[t_] =
      If[D[golf,t]>0,(t^4+t*3),(t^2.5-t)]
    ];
Key[2]

        22

Here is what we have stored

?Key

Global`Key

Key[t_] = If[-1 + 2*t > 0, t^4 + t*3, t^2.5 - t]

--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

"liwen liwen" <gzgear at yahoo.com> wrote in message
news:974vp8$6jh at smc.vnet.net...
> Dear friend,
>          How are you!Now I encounter a problem that I
> can not solve for a long time .
> It can be express simplely as how to define a
> polyfunction,for example,a simple polyfunction may be
> defined as that:
>
> Key[t_]:=If[(t>0),1,0];
>
> It is easy to define.However,it will be more difficult
> when the condition turns more complicate.For instance:
> golf=t^2-t;
> Key[t_]:=If[(D[golf[t],t]>0),(t^4+t*3),(t^2.5-t)];
>
>
> Best regards,
>
>
> Liwen
> E-mail:  gzgear at yahoo.com
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - Buy the things you want at great prices!
http://auctions.yahoo.com/
>




  • Prev by Date: Re: export eps with fonts 4.01?
  • Next by Date: Re: Extracting units from a list of values
  • Previous by thread: Re: How to define a polyfunction?
  • Next by thread: Re: How to define a polyfunction?