Is it an error in Mathcad?


@ValeryOchkov wrote:
Is it an error in Mathcad?
Not at all. Its the behaviour as it should be.
Note that the global b and the local b have nothing to do with each other! The local b is a new variable created by the program and as you don't provide a value for the element with index 0, this element is initialized with 0 as usual.
If you want a global variable to be used in a program you have to either provide it as an argument of your function or you must use it on the right hand side of a local assignment as you did with variable a.
In your program "a" is local only for a sort moment. after the fist assignment which introduces the global "a" on the right hand side it turns into the global variable. As ttokoro showed, just "mentioning" b (his first program line) does the job as well. I am not sure if this behaviour is OK from a purists point of view. The "normal" way to do it used to be the dummy assignment b <-- b.

P.S.: It looks like you are using a 4K monitor like me (in combination with a large windows zoom factor). Thats the reason your screenshots are far too large when you embed them here. To make your post better readable I would advice that you either scale down the pics with an appropriate program or at least resize them after you embed them in your post.
No account yet? Create an account
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.