Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2007

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

Search the Archive

Re: How to express this function.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg84240] Re: How to express this function.
  • From: mark <markmgg at googlemail.com>
  • Date: Fri, 14 Dec 2007 23:18:26 -0500 (EST)
  • References: <fjunch$27q$1@smc.vnet.net>

On Dec 15, 12:00 am, "huxiaopengs... at gmail.com"
<huxiaopengs... at gmail.com> wrote:
> f is  a period continual function with period  1.
> f equals x when 0<x1/2,equals -x when -1/2<x<1.
>
> How to express this function?

The function "Which" will do that for you.

The problem is when f equals x, the condition wasn't clear (I mean
0<x1/2) but I will use the following example to illustrate the method,
and then you will have do some changes to suite your problem:

In[1]:= f[x_] := Which[-1/2 < x < 0, -x, 0 < x < 1/2, x]

In[2]:= f[1/4]

Out[2]= 1/4

In[3]:= f[-1/3]

Out[3]= 1/3



  • Prev by Date: Re: How to express this function.
  • Next by Date: Re: How to express this function.
  • Previous by thread: Re: Re: How to express this function.
  • Next by thread: Re: How to express this function.