MathGroup Archive 2007

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

Search the Archive

Re: Hole/Disk function

  • To: mathgroup at
  • Subject: [mg76085] Re: Hole/Disk function
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at>
  • Date: Wed, 16 May 2007 05:23:46 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <f2bs7i$gc0$>

Mathieu G wrote:
> Hello,
> Is there a better way to define a Disk/Hole function than that?:
> DHole[x_, y_] := If[Sqrt[x^2 + y^2] <= HoleSize, 1, 0];

Avoiding global parameters is usually a good idea. Also, the Boole 
function does the same thing as your If... expression but in a more 
efficient way.

DHole[x_, y_, holeSize_] := Boole[Sqrt[x^2 + y^2] <= holeSize]


  • Prev by Date: Re: Solve & RotationMatrix
  • Next by Date: Fit
  • Previous by thread: Re: Hole/Disk function
  • Next by thread: Re: Hole/Disk function