Hi, Michael,
I almost know the difference of them. However, there is another topic that i want to talk after reading your reply.
I almost know the difference of them. However, there is another topic that i want to talk after reading your reply.
In[]:=
Clear[a,x,y,f,ff,g,h];f=ax^2;g=ay^2;h=az^2;z=7;y=4;Grid[{Thread@HoldForm@{Command,"",x,y,z,a,"",f,ff,g,h'},Block[{x=3,y=5,z,a,ff},ff=ax^2;{Block,"",x,y,z,a,"",f,ff,g,D[h,z]}],Module[{x=3,y=5,z,a,ff},ff=ax^2;{Module,"",x,y,z,a,"",f,ff,g,D[h,z]}]},Dividers->All]
Out[]=
Command | x | y | z | a | f | ff | g | ′ h | ||
Block | 3 | 5 | 7 | a | 9a | 9a | 25a | 14a | ||
Module | 3 | 5 | z$240681 | a$240681 | a 2 x | 9a$240681 | 16a | 0 |
From below example, we know that inside Module, it do not recognize z although it is defined outside Module.
so what i do not understand is why Module can recognize f as a x^2; why the definition of f can work inside Module.
so what i do not understand is why Module can recognize f as a x^2; why the definition of f can work inside Module.