MathGroup Archive 2002

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

Search the Archive

Re: Functions in Mathematica

Ravinder Kumar Banyal schrieb:
> Dear All,
> Can anyone please tell me how we define and Plot functions
> of the following types in mathematica.
> e.g.
>  1)   Box function with amplitude c            
>             f(x)= C for -2<x<2  (c is constant)   
>                 = 0 otherwise

there are several possibities:

This one is good if you need it to eg FourierTransforms

f[x_]:=Which[-2<=x,0, -2<x<2,c, x>=-2,0]
good if you need to differentiate ist. Mathematica can differentiate
Which-expressions (but not integrate out of the box)

>  2)   Triange
>             f(x) = x for -1<x<0
>                  = 1-|x] for 0<x<1 
Just the same as above

>  3)  A suare wave with specific period and width
f[x_]:=c/; 0<Mod[x,3]<1
makes a period of three 

Gruß Peter
 Peter Breitfeld, Bad Saulgau, Germany   Meinen GnuPG/PGP-5x Key gibts dort

  • Prev by Date: Re: Plot inset?
  • Next by Date: Re: [Q] : huge number, ciphers after decimal point?
  • Previous by thread: Functions in Mathematica
  • Next by thread: Re: Functions in Mathematica