MathGroup Archive 2002

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

Search the Archive

Re: Functions in Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg33690] Re: Functions in Mathematica
  • From: phbrf at t-online.de (Peter Breitfeld)
  • Date: Mon, 8 Apr 2002 03:04:15 -0400 (EDT)
  • References: <a8m2eo$o9d$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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:
f[x_]:=c/;-2<x<2
f[x_]:=0

or
f[x_]=c(UnitStep[x+2]-UnitStep[x-2])
This one is good if you need it to eg FourierTransforms

or
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
> 
e.g.
f[x_]:=c/; 0<Mod[x,3]<1
f[x_]:=0
makes a period of three 


Gruß Peter
-- 
=--=--=--=--=--=--=--=--=--=--=--=--=--= http://home.t-online.de/home/phbrf
 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