- #1
Fat Ryan
- 50
- 0
Mods, I wasn't sure where to put this, so please move it if its not in the correct section. Thank you.
I am in a computer structural analysis class that utilizes MathCAD as the means for all computations throughout the semester. I've never used it before, so I am having some issues. I have the book "Essential MathCAD", but there are a couple items I can't seem to find in the book (perhaps I'm looking in the wrong section?).
Anyways, the primary reason for using MathCAD in this class is to develop custom routines for doing very specific calculations. I have experience programming in VB and C++/Java; however, I'm finding it quite the PITA to program in MathCAD. One major pet pieve of mine is that I can't seem to figure out a way to add a new line in the middle of an existing routine. Every time I try clicking "add a line" in the programmer's toolbox, it does some crazy stuff and adds parenthesis and/or rearranges a bunch of stuff in the routine. No matter where the cursor is when I click "add a line", it never simply adds a line (or it adds it in the totally wrong place). Doing this in Java is beyond simple, its like adding a line in a Word document...no funny business happens. Can someone give me some guidance on this?
The next thing I'm stuck on is the output from the routine. In my particular homework assignment, I need to have an output for a particular error that includes one of the arguments in the output. It doesn't appear that this can be done with the "return" function.
Lastly, the program is supposed to exit if I have an "i" or "k" greater than the amount of rows or columns. I put a "break" function into the program, but when I execute it with the error, the program outputs "5". It doesn't matter what I change up for i & k, it still outputs "5" for some reason.
Below I have posted my assignment and my solution thus far. If you could help me out with anything, I'd appreciate it. Also, I feel like my routine is much longer than it needs to be (although it does work correctly as is), so any advice on consolidating the code is much appreciated. Thanks.
p.s.- Sorry, I posted pix because I wasn't sure how to copy the code from MathCAD...selecting and copying didn't do anything :/
I am in a computer structural analysis class that utilizes MathCAD as the means for all computations throughout the semester. I've never used it before, so I am having some issues. I have the book "Essential MathCAD", but there are a couple items I can't seem to find in the book (perhaps I'm looking in the wrong section?).
Anyways, the primary reason for using MathCAD in this class is to develop custom routines for doing very specific calculations. I have experience programming in VB and C++/Java; however, I'm finding it quite the PITA to program in MathCAD. One major pet pieve of mine is that I can't seem to figure out a way to add a new line in the middle of an existing routine. Every time I try clicking "add a line" in the programmer's toolbox, it does some crazy stuff and adds parenthesis and/or rearranges a bunch of stuff in the routine. No matter where the cursor is when I click "add a line", it never simply adds a line (or it adds it in the totally wrong place). Doing this in Java is beyond simple, its like adding a line in a Word document...no funny business happens. Can someone give me some guidance on this?
The next thing I'm stuck on is the output from the routine. In my particular homework assignment, I need to have an output for a particular error that includes one of the arguments in the output. It doesn't appear that this can be done with the "return" function.
Lastly, the program is supposed to exit if I have an "i" or "k" greater than the amount of rows or columns. I put a "break" function into the program, but when I execute it with the error, the program outputs "5". It doesn't matter what I change up for i & k, it still outputs "5" for some reason.
Below I have posted my assignment and my solution thus far. If you could help me out with anything, I'd appreciate it. Also, I feel like my routine is much longer than it needs to be (although it does work correctly as is), so any advice on consolidating the code is much appreciated. Thanks.
p.s.- Sorry, I posted pix because I wasn't sure how to copy the code from MathCAD...selecting and copying didn't do anything :/
2) Write a Mathcad function that exchanges the rows, columns, or rows and columns of a square symmetric matrix C. Indices i and k represent the rows or columns to be
exchanged, and the variable e is used to tell the program which operation is to be executed:
e = 1 means row exchange
e = 2 means column exchange
e = 3 means row and column exchange
The program should exit before attempting the exchange if the matrix not symmetric, if a code of e other than 1, 2, or 3 is entered, or if an indicated row or column is outside the bounds of the matrix. The message should be explicit as to what the problem is (e.g. "Error, an e code of 4 was entered"). If more than one error exists, the program should list the errors in separate lines, but in a single execution of the routine.