Also handle negative coordinateswith symmetry.

With some clever manipulation you

can get the following recurrence relationship:

Code: Select all

```
a,b non-negative.
R(a,b) the resistance is (a>=b):
if b=0 -> 4*R(a-1,0)-R(a-2,0)-2*R(a-1,1)
else if a=b -> (4*(a-1)*R(a-1,a-1)-(2*(a-1)-1)*R(a-2,a-2))/(2*(a-1)+1)
else if a=b+1 -> 2*R(b,b)-R(b,b-1);
otherwise -> 4*R(a-1,b)-R(a-2,b)-R(a-1,b+1)-R(a-1,b-1)
Base Cases are:
R(0,0)=0
R(1,0)=0.5
R(0,1)=0.5
R(1,1)=2/pi
```

accurate to 3 decimal places or more.