Skip to main content
13-Aquamarine
August 9, 2024
Solved

For loop with matrix

  • August 9, 2024
  • 2 replies
  • 1020 views

hello everyone,
i am trying to get 'z' as matrix as shown in the attached Mathcad 10 sheet.
i do not know where it is going wrong
could someone help me here

Best answer by ttokoro

image.pngimage.png

2 replies

ttokoro
21-Topaz I
ttokoro21-Topaz IAnswer
21-Topaz I
August 9, 2024

image.pngimage.png

t.t.
25-Diamond I
August 9, 2024

As ttkoro has shown, you have forgotten the vector index at z and you had put the increment of i outside and after the loop. So actually you applied the calculation six times to the first vector element and then you got this single value as your result.

 

But why not simply

Werner_E_1-1723181980982.png

 

If you insist on using a loop, you could do it a bit shorter like this

Werner_E_0-1723182239506.png

Note the that local variable in the program must not have the same name as the variable you intend to assign the result to. But of course there is nothing wrong if you use a local variable "z" instead of  "Result".