I need the following integral to use it later on for a nested integral:

i3[z1_?NumericQ, z2_?NumericQ] := i3[z1, z2] = NIntegrate[1/(1+(1+(x1-
x2)^2)^(1/3)), {x1, 0, z1}, {x2, 0, z2}, Method -> "MonteCarlo" ​];

Unfortunately, if I run i3[1,1], it does not return me any numerical value? If I remove Method -> "MonteCarlo" ​, then things work. However, I need this method for the purpose of computation speed. Any ideas how to fix this? Thanks!

  • $\begingroup$ Why the i3[z1, z2] = part? $\endgroup$
    – Feyre
    Aug 18, 2016 at 9:06
  • $\begingroup$ @Feyre it's a memoization for function. $\endgroup$
    – m0nhawk
    Aug 18, 2016 at 9:07
  • $\begingroup$ Did you copy this code from a comment on this website? There are problems with comments recently that insert invisible characters that break the code. meta.mathematica.stackexchange.com/questions/1955/… ( @m0nhawk ) $\endgroup$
    – Szabolcs
    Aug 18, 2016 at 9:47
  • $\begingroup$ I did not copy this code from any website. Unfortunately, I did not realise that there was a space after "MonteCarlo", which seems to be the main trouble. $\endgroup$
    – konstant
    Aug 18, 2016 at 9:49
  • $\begingroup$ No, the space is not the problem. The problem is the invisible zero-width space (Unicode 0x200b) character after the standard space. Have you any idea how it got there? $\endgroup$
    – Szabolcs
    Aug 18, 2016 at 9:51

1 Answer 1


You have some issue with the encoding.

If you copy your part into some HEX editor you'll get:

"MonteCarlo" ​];

While the correct is:

п»ї"MonteCarlo" ];

The п»ї part is a EF BB BF, just a UTF-8 marker.

And the problem is: ​, it's a "ZERO WIDTH SPACE" with code E2 80 8B. Removing that space will result in a correct execution.

This may be some copy-paste protection from a third-party sites.

  • $\begingroup$ Actually it appears to just be a typo, i3[z1_?NumericQ, z2_?NumericQ] := i3[z1, z2] = NIntegrate[ 1/(1 + (1 + (x1 - x2)^2)^(1/3)), {x1, 0, z1}, {x2, 0, z2}, Method -> "MonteCarlo" ]; work fine, the rules are differet, this gives 0.489461 as result. $\endgroup$
    – Feyre
    Aug 18, 2016 at 9:11
  • $\begingroup$ I used a clear kernel, works fine for me. $\endgroup$
    – Feyre
    Aug 18, 2016 at 9:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.