[Archive!] Pure mathematics, physics, chemistry, etc.: brain-training problems not related to trade in any way - page 233
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
In general, no offence to the developers of MQL, but the number of math functions https://docs.mql4.com/ru/math
is shamefully small in my opinion, as it is in VB. And the definitions of some of them, like MathFloor, are murky.
-
Take MathMax function, there are only 2 arguments. And if I need 10 or 20, then what does that turn into?
Here's what it looks like in VB with my module:
-
x=max(x1...x20) 'finds the maximum value of 20 variables;
x=max(x1, y, z, p) 'finds the maximum value of 4 variables;
А вобще, какой то грек сказал что Pi=66/21
The Greek must have said 22/7 (the same as 66/21).
More accurate would be 355/113 (accuracy is 3*10^(-7) ).
The next best fraction is already 103993/ 33102 (accuracy on the order of 6*10^(-10) ).
2 Richie: Well, you had to finish the VB as well. So, why are you going after the Metacquotes then?
Take a joke
Take a joke
Mischek, we're former postgraduates, we're solving 8th grade problems, not 11th :)
Poor kids.
There you go, I suspected it was a problem...
OK, let's see.
Let's deal with the first loop,
The loop is executed as long as expression b - c is evaluated as true. What is true in C? Anything not zero, it seems. So, the loop increasing b from zero and filling array f[] is executed till b equals to c, i.e. till 2800. Array f[] is filled with the same numbers 10000/5 = 2000.
Not much wrong so far?
There's only one way to calculate pi anyway, and the rest is a mashka in a different skirt, or part of a mashka :)
Ну вот, подозревал ведь, что это задачка...
ОК, смотрим.
Разбираемся с первым циклом,
Цикл выполняется до тех пор, пока b - c = true. Что такое true в Си? Кажись, любой не нуль. Значит, цикл увеличения b от нуля и заполнения массива f[] выполняется до тех пор, пока b не сравняется с с, т.е. до 2800. Массив f[] заполняется одинаковыми числами 10000/5 = 2000.
Пока не сильно ошибся?
Let's have a crack at it.
Right so far. Let's keep watching.
But further on it's not clear. Condition d=0 in the first header (outer loop) is bothering me somehow. Is it always true?
Next, a nested loop. We rewrite it: