i as formal argument in function definitions

i as formal argument in function definitions - Сообщения

#1 Опубликовано: 25.02.2013 17:45:30
Martin Kraska

Martin Kraska

1222 сообщений из 2150 понравились пользователям.

Группа: Moderator

I encountered the problem that I cannot use i as formal argument in function definitions. This is surprising to me, since i can be redefined in other situations (eg. by use as loop variable). May be this has been discussed earlier, but I don't find a hint.

Seems like one more oddity that is hard to explain. Or did I miss something?


ifunction.PNG
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#2 Опубликовано: 26.02.2013 04:29:34
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: Moderator

Hello Martin,

I remember this issue has been mentioned here more than few times. See for instance this one Treatment-of-imaginary-unit.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
2 пользователям понравился этот пост
Davide Carpi 26.02.2013 05:34:00, Martin Kraska 26.02.2013 05:44:00
#3 Опубликовано: 26.02.2013 05:42:53
Martin Kraska

Martin Kraska

1222 сообщений из 2150 понравились пользователям.

Группа: Moderator

Wrote

Hello Martin,

I remember this issue has been mentioned here more than few times. See for instance this one Treatment-of-imaginary-unit.

Regards,
Radovan



Thank you, Radovan. I see that the resistance to i as formal parameter is hardwired in order to cover leaks in the optimization procedures. Would the formal parameters really be treated as local variables then life would be much easier.

In my handbook I frequently use i as variable name (loop counters, indices) in the hope that one day Andrey will find a clean solution that allows for unlimited use of i as variable name.

With a little criminal energy there is a workaround, see attachment. The trick is visible but not obvious and therefore cannot be recommended for regular use.

Martin




ifunction2.PNG
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#4 Опубликовано: 26.02.2013 06:14:41
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: Moderator

Wrote

With a little criminal energy there is a workaround, see attachment. The trick is visible but not obvious and therefore cannot be recommended for regular use.


The i. (dot after i - it can be seen by looking at the braces, they are a bit larger) is of the most troublesome and problematic issue to explain to beginners (is there an index or not? it looks like one, why it is not working as expected?? etc.) During all these years I am always having the same kind of questions and explanations to my students ,over and over, about "literal", "real one", "fictive", "dot as a part of variable name" and all kinds of errors in spite of endless repeating of that.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений