# Help with getting an output from some calculations

I entered the following from @Rahul's answer in "Help with finding the point(s) inside a closed shape with the highest average ray length?" below my post. He told me I should enter his data one input at a time. The problem is I could not get a numerical number from my final input. Rahul believe there was problem with my computer. Here is the link to my calculations

In my first input tab I placed

curve =
DiscretizeRegion[
ImplicitRegion[x^2 + y^2 + Sin[4 x] + Sin[4 y] == 4, {{x, -3, 3}, {y, -3, 3}}]]


Where I got a picture of the curve as in @Rahul's answer.

Then in my second input tab I placed

q = MeshCoordinates[curve];
edges = First /@ MeshCells[curve, 1];
signedAngle[a_, b_] := Arg[(Complex @@ a)/(Complex @@ b)]
1/(2 π) Abs[
Sum[
Module[{q1, q2, r, dθ},
q1 = q[[First @ e]];
q2 = q[[Last @ e]];
(* midpoint approximation *)
r = EuclideanDistance[p, (q1 + q2)/2];
dθ = signedAngle[q1 - p, q2 - p];
r dθ],
{e, edges}]]


Finally in the third input tab I placed the following (but got the output in (**) to be).

avgRadius[{0, 0}]


In my original post, I asked if someone could reply but it has been days and no one has said anything. Is there a possible way of getting a numerical output from my calculations? Is there something wrong with my computer?

• The indentation of the lines following q = ... implies that some of your definitions are running together. Terminate each definition with ; to insure that there is no parsing mistake. avgRadius[{0, 0}] then returns 1.99725. – Bob Hanlon Jan 5 '16 at 22:49
• @BobHanlon Could you show where exactly to place the semicolons I have tried doing this and still could not get any results. – Arbuja Jan 6 '16 at 2:37
• There will be no trouble if you start with a fresh kernel and evaluate eachSet andSetDelayed in a separate cell. – m_goldberg Jan 6 '16 at 6:06

curve = DiscretizeRegion[
ImplicitRegion[
x^2 + y^2 + Sin[4 x] + Sin[4 y] == 4, {{x, -3, 3}, {y, -3, 3}}]]


q = MeshCoordinates[curve];

edges = First /@ MeshCells[curve, 1];

signedAngle[a_, b_] := Arg[(Complex @@ a)/(Complex @@ b)];