0

Obviously the following two functions bring the same results:

r = Sqrt[x^2 + y^2];
fr[x_, y_] := Sqrt[x^2 + y^2];

Table[r, {x, 0, 1, .25}, {y, 0, 1, .25}]
Table[fr[x, y], {x, 0, 1, .25}, {y, 0, 1, .25}]

What are the programming specific advantages of one function compared to the other?

Kay
  • 1,035
  • 7
  • 19
  • 1
    Have a look at Menu/Help/WolframDocumentation/Set and Menu/Help/WolframDocumentation/SetDelayed. Look please also into the section "Details" and then go through some examples. You will find all the information there. – Alexei Boulbitch Aug 15 '17 at 09:50
  • Thank you! The overview "assignments" in the manual, opened my eyes! – Kay Aug 15 '17 at 10:04
  • I found this very good explanation: link – Kay Aug 15 '17 at 10:13
  • 2
    Actually, I wouldn't say that Table[r, {x, 0, 1, .25}, {y, 0, 1, .25}] "obviously" produced the same result as the table with fr[x,y]. The fact that the table with r works is only because of very specific internals of how Table works. The form with fr should be considered to be the normal way to define a function and r should be considered to be a mathematical formula. – Sjoerd Smit Aug 15 '17 at 10:15

0 Answers0