RE: How to define a polyfunction?
- To: mathgroup at smc.vnet.net
- Subject: [mg27406] RE: [mg27389] How to define a polyfunction?
- From: "Higinio Ramos" <higra at gugu.usal.es>
- Date: Sun, 25 Feb 2001 00:53:29 -0500 (EST)
- References: <200102230733.CAA06963@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
----- Original Message -----
From: liwen liwen <gzgear at yahoo.com>
To: mathgroup at smc.vnet.net
Subject: [mg27406] [mg27389] How to define a polyfunction?
> 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)];
>
This may be a solution:
golf=x^2-x;
Key[t_]:=If[(D[golf,x]/.x->t)>0,t^4+t*3,t^2.5-t];
Even you mey plot the function wher it is defined:
Plot[Key[t],{t,-1,1}]