Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
Hello all,
I am in MathCad 14 and have two objects on the screen. One is a variable 'n' and another is a 1-by-n matrix where n is the value that the variable 'n' takes.
How can I have the matrix resize automatically to whatever the variable 'n' takes? For example, If I choose n = 3 then the matrix should be 1-by-3.
Any help or direct syntax would help immensely. Thank you.
Solved! Go to Solution.
So I like your second method - input a matrix of distances, and then have Mathcad multiply them and take the nth root.
(Note: I've set the ORIGIN to 1, hence i=1 to n.)
The following was done in Prime, but I believe it works in MC14 as well.
Roger,
This helps a lot, but I am still stuck on something. What I want is that after the matrix is created from choosing 'n' to then allow the user to enter in the values to that matrix. Do you know how this behavior can be captured in syntax? Thank you.
Joe G.
Joe Grady wrote:
Roger,
This helps a lot, but I am still stuck on something. What I want is that after the matrix is created from choosing 'n' to then allow the user to enter in the values to that matrix. Do you know how this behavior can be captured in syntax? Thank you.
I dont' believe this can be done in M14 without resorting modifying the underlying xml code (using a scripted component to get at the Mathcad application programming interface), or perhaps with some arcane file input/output operations.
M:=0 (only needed if M was defined previously in the worksheet)
M[0,n-1:=0, where '[' is the index operator (this initializes M to an 1xn matrix of zeros)
M=(0 0 ... 0)
What are you trying to do with the matrix? What values do you want it to take?
Stuart
Stu, the matrix will take only positive real decimal numbers. Each entry in the matrix will be multiplied by each other and then rooted by the number of entries. This should be the formula for calculating the GMD of a group of spaced powerlines no matter what spacing is between any two power lines. What I want to do is set it up so that someone who looks at my page can just choose a number of conductors and then once that is chosen the matrix will resize itself and then allow the user to enter in each entry. Once each entry is entered, multiply them all together and then take the n-th root.
Either that or enter in the matrix elements first. This way n is equal to the number of elements in the matrix rather than choosing what n is. Seems like this path would be easier to travel for MathCad's sake.
So I like your second method - input a matrix of distances, and then have Mathcad multiply them and take the nth root.
(Note: I've set the ORIGIN to 1, hence i=1 to n.)
Thank you! This will work great.