# How to represent characteristic function of a single-point set?

I am trying to find the way how to represent characteristic function of a single-point set. My idea was to write the points by set:

Ainput = {{2/5, 1/4}};

ListPlot[Ainput, PlotRange -> {{0, 1}, {0, 1}}] Now I want to find a y coordinates for points

{{x -> 2/5}, {x -> 3/5}}

but because I don't have Ainput defined like a function it gives me in both points 0 results instead of 1/4,0. Do you have any suggestions how could I define the function or how could I find the y-coordinate? Thank you.

• Could use KroneckerDelta: In:= f[x_] := 1/4*KroneckerDelta[x - 2/5] Map[f, {2/5, 3/5}] Out= {1/4, 0} – Daniel Lichtblau Dec 15 '18 at 16:00

#[[1, 2]] Boole[x == #[[1, 1]]] &@Ainput /. {{x -> 2/5}, {x -> 3/5}}


{1/4, 0}

Also

Function[x, #[[1, 2]] Boole[x == #[[1, 1]]] &@Ainput] /@ {2/5, 3/5}


{1/4, 0}

• The OP might be interested in the difference between Function[x, #[[1, 2]] Boole[x == #[[1, 1]]] &@Ainput] /@ {2/5, 2/5 + 10.^-15} and Function[x, #[[1, 2]] Boole[x - #[[1, 1]] == 0] &@Ainput] /@ {2/5, 2/5 + 10.^-15} – Michael E2 Dec 16 '18 at 1:49