
You are learning programming for the first time using Mathematica and you want to get familiar with this construct, which is very common in C-like languages. You are translating code from a language which has an analogous for construct (C, C++, Java, etc.) and you want to minimize the risk of messing up something, at least during the first pass of translation You're facing one of the very rare cases when it really provides a simpler solution than the alternatives If you are a beginner in Mathematica I recommend that you avoid For for now in favour of Do or While. These are called procedural constructs and they are not what we usually use in Mathematica (though they're definitely necessary and advantageous in some situations) Here are several examples which should get you started: (I started calling it that somewhere around V4, so maybe I should increment that!) As an example, below are a few more ways to calculate N Factorial. It does of course have Do, For, and While - and these are still useful in some calculations, especially where results are built up in an iteration, like you are doing calculating N factorial.īut I usually call Mathematica a 10th generation language. But I would also like to point out that Mathematica offers a significantly different paradigm in programming compared to mainly procedural languages like C. Finance, Statistics & Business Analysisĭaniel is of course correct, and perhaps has better sense than I do in that he gave you a direct answer to your question.Wolfram Knowledgebase Curated computable knowledge powering Wolfram|Alpha. Wolfram Universal Deployment System Instant deployment across cloud, desktop, mobile, and more.

Thank you in advance for your time and kindness.Wolfram Data Framework Semantic framework for real-world data. Do you happen to know what I'm doing wrong as well as a way to get rid of those annoying error messages? I mean, mathematica still returns the result (and that is great), but the fact that something seems off (and I can't understand the reasons behind it) really bothers me.


I also tried to replace NumericQ with NumberQ (in every possible permutation), but nothing changed. General::stop: Further output of NIntegrate::inumr will be suppressed during this calculation. I was trying to numerically perform the nested integration here belowį(a)=\int_0^.
