Matrices multiplication with vector
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Matrices multiplication with vector
Hello there,
I got just one simple problem. Why does when I copy my old program it doesn't work on new program? Here I attach pictures of my matrix program. In the meantime, I don't understand how does the program work actually. Do you mind to explain? Appreciate for the help. Thanks.
Solved! Go to Solution.
- Labels:
-
Mathcad Usage
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@Adlil wrote:
Hello there,
I got just one simple problem. Why does when I copy my old program it doesn't work on new program? Here I attach pictures of my matrix program. In the meantime, I don't understand how does the program work actually. Do you mind to explain? Appreciate for the help. Thanks.
It's difficult to tell without the worksheets, but I'm going to guess that you've copied your expressions into a worksheet that has ORIGIN:=0 from a worksheet that has ORIGIN:=1.
Stuart
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@Adlil wrote:
Hello there,
I got just one simple problem. Why does when I copy my old program it doesn't work on new program? Here I attach pictures of my matrix program. In the meantime, I don't understand how does the program work actually. Do you mind to explain? Appreciate for the help. Thanks.
It's difficult to tell without the worksheets, but I'm going to guess that you've copied your expressions into a worksheet that has ORIGIN:=0 from a worksheet that has ORIGIN:=1.
Stuart
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you for your reply. Yup I also suspected that. Here I attached both of my programs. The old program is the one with my name 'Мухамад Адлил' and it's located at exercise no.8 (задание 8).While the new program is written 'new' . I hope my explanation is clear, pardon for my English.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Even without seeing the sheet Stuart guessed correctly what the problem might be and as you also suspected that a different value for ORIGIN is the cause of the problem (and it actually is), where do you still have problems???
You can always check which value of ORIGIN is currently in use by evaluating this system variable by typing ORIGIN =
You have at least three options to make your program work:
- Change the value of the system variable ORIGIN from its default value 0 to the value 1 because the program you copied is assuming this value.
You can do this either by writing ORIGIN:=1 somewhere at the top of your worksheet or change the value in the menu -> "Tools"-"Worksheet Options"-"Built-In Variables"-"Array Origin" - Change the program to work with value ORIGIN=0 as it is set by default in your worksheet. You simply have to change all loops which run from 1 to 3 to loops that run from 0 to 2
- (The preferred option IMHO) Change the program so that it is ORIGIN-aware, which means that you can use it unchanged in any worksheet, no matter what ORIGIN is set to
You may notice that in the last program I streamlined the last loop a little bit, getting rid of the variable C.
This last program is also written in a way so that it works no matter what the dimensions of A an B actually are (as long as the number of columns in A is equal to number of elements/rows in vector B)
Of course normally you would turn the program into a function with A and B as its arguments. But in this case it seems to be just an exercise in programming in Mathcad.
BTW, here is an even shorter version of the program - getting rid of the intermediate matrix k as well:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you so much for the help. Your explanation help me a lot. I've been experimenting with the solutions that you gave. Appreciate it. May God bless you.
Regards,
Adlil.
