Use Dirac Function

Hi, I’m still a beginner on Mathematica, I have a question please, I need the Dirac function which equals 1 on f 0 and 0 for the other values. the DiracDelta [.] function does not give 0 in 0 !!

Check the documentation for DiracDelta.

I already saw them, the DiracDelta function gives 0 in every point different from zero, but the problem is in 0 does not give 1 !!!

The DiracDeta function is really not a function, it is a distribution. DiracDelta[0] does not have a value. It is defined by its effect under integration, which Mathematica performs correctly:

Integrate[f[x] DiracDelta[x - a], {x, -Infinity, Infinity}, 
 Assumptions -> a \[Element] Reals]

(* f[a] *)

The value of the Dirac delta function at 0 is not 1. Check the WikiPedia page. From the documentation

DiracDelta stays unevaluated for x==0

Integrate[DiracDelta[x], {x, -Infinity, Infinity}]
(* 1 *)

Maybe you want:

  DIRAC[x_] := Piecewise[{{1, x == 0}}](*Defining a new function called DIRAC*)
  {DIRAC[0], DIRAC[1], DIRAC[-2]}

  (*{1, 0, 0}*)

Try using DiscreteDelta instead

thank you, that’s it.