Help me! :( {calculating potential field}

Hi everybody
I want compute total potential field near some Nano Metal particles. I wrote Mathematica code for this purpose, but my results are not correct. What is wrong? :frowning:

Download My code HERE

You should stick a bit with the syntax, in S2C[] and C2C[] the Return[] is syntactic sugar. I’m not sure whether the indexed Part[]-Operator [[]] like in

Capture.PNG

do really work as you intend it (Part[] normally goes unindexed) and last but not least, it’s better for [\pi]tOut and [\phi]tIn to use a Block[] structure, i.e. instead of

fOut[…] := (a = 0; b = 0; <more expressions>)

please use

fOut[…]:= Block[{a=0, b=0}, <more expressions>]

Is there some test case you know the result for to check with?

*Thanx Udo

I changed the functions and I used Block command but results are not changed :frowning:

why mathematica show this error: "Result for RowReduce of badly conditioned matrix "

(Download Edited code HERE)*

To try to evade the badly conditioned equations I appended thirty trailing zeros to each of the decimal values and I changed each //N to N[…,30].

When I then evaluated each cell one at a time and get down to your Solve it finds no solution and returns {}

I think all this strongly points towards there being a problem with the construction of EQS.

If you study that very carefully can you find any errors hiding in that?

I am very impressed with your use of Dropbox and how smoothly that works.

*Thanks Bill

In first my post I described that the equations how to construct (I showed them with a red rectangle). Maybe I need to more study :(*