# How can I Plot DiracDelta function with complex number?

The function is:

y[w_]= 0.32 DiracDelta[(2.495*10^-21 + 0. I) + 1.054*10^-50 w]
+ 1.19 DiracDelta[(1.979*10^-20 + 0. I) + 1.054*10^-58 w];


Question 1) How can I remove all component less than 10^(-22) in y[w_]? (or remove "0.I")
Question 2) How I can Plot[y[w]]?

• Look up Chop[]. – J. M.'s ennui Jul 26 '16 at 8:16
• Concerning a way of representing DiracDelta[] with graphics primitives, here is a solution. – andre314 Jul 26 '16 at 8:44
• but I can't convert y[w_] to Fourier transform? which is the exactly function here I must use? – Haimuoi Jul 26 '16 at 9:11

You can use Round to get rid of small component.

Round[1. + 10.^-5 I, 10.^-6]


$1. + 0.00001 \rm I$

Round[1. + 10.^-5 I, 10.^-3]


$1.$

y[w_,n_]= Round[0.32 DiracDelta[(2.495*10^-21 + 0. I) + 1.054*10^-50 w]
+ 1.19 DiracDelta[(1.979*10^-20 + 0. I) + 1.054*10^-58 w],10.^-n];


to eliminate numbers less than 10^-n

How to Plot

Here I define a plotting function ddplot

y[w_] = 0.32 DiracDelta[(2.495*10^-21 + 0. I) + 1.054*10^-50 w] +
1.19 DiracDelta[(1.979*10^-20 + 0. I) + 1.054*10^-58 w];
ddplot[n_] := ListPlot[Cases[y[0], x_ DiracDelta[y_] :> Round[{y, x}, 10.^-n]],
Filling -> Bottom]

ddplot[22]
ddplot[20]


• It didn't work , Mathematica said "ListPlot::argx: ListPlot called with 0 arguments; 1 argument is expected. >>" . Could you repair it? – Haimuoi Jul 27 '16 at 0:26
• Which version of Mathematica are you using? Are you using y[w_] or y[w_,n_]? For plotting you have to use y[w_], similar to the one you wrote in your question. – Sumit Jul 27 '16 at 6:15
• Yes, I used y[w_] and version 9.0. But "0.I" is the result of previous calculations (in my progress). – Haimuoi Jul 27 '16 at 7:08
• hmm. What is the output of y[0]? Perhaps that is where I miss something ! – Sumit Jul 27 '16 at 8:06

(Extended comment)

y[w_] = 0.32 DiracDelta[(2.495*10^-21) + 1.054*10^-50 w] +
1.19 DiracDelta[(1.979*10^-20) + 1.054*10^-58 w]

ti00 = Collect[y[w], DiracDelta[_], coeff]

ti01 = ti00 /.
coeff[c_] DiracDelta[exp_] :>
With[{ww = w /. Last[Solve[exp == 0, {w}]]},
Line[{{ww/(2 Pi), 0}, {ww/(2 Pi), Abs[c]}}]]

Graphics[List @@ ti01 , AspectRatio -> 1, Frame -> True]


• Thank you very much, but I still wonder why DiracDelta not reach infinity in your graphic? Could you help me plot another function (it has a division)! z[w_]=0.32 DiracDelta[(2.495*10^-21 ) + 1.054*10^-50 w] + 1.19 DiracDelta[(1.979*10^-20) + 1.054*10^-58 w]/ ( w (-8*10^-21 + 1.05*10^-34 w)^2 + 3.8*10^-25 (1.3 DiracDelta[(-2.23*10^-20) + 1.05*10^-34 w]) – Haimuoi Jul 26 '16 at 22:31
• @Haimuoi If you see a Dirac as the limit of schrinking pulses with constant surfaces S, then S is the value that determine the strengh of the Dirac. The lines in the graphic are representing the S. Concerning the second part of your comment, I have no answer. – andre314 Jul 27 '16 at 18:48
• Dear @andre.! Thank you for your help :) I'll try. – Haimuoi Jul 28 '16 at 5:01