cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

How can I express matrix?

jlee-2
1-Newbie

How can I express matrix?

%EC%BA%A1%EC%B2%983.PNG

I want to express several column, not one column.

I searched for my book about mathcad and help in PTC mathcad. But I don't know. Could you help me?

I want to express to see easily because the row is 80

For example

current my picture-

[1]

[2]

[3]

[4]

[5]

my wanttng

[1 2 3 4 5 ]

[a b c d e ]

[ .... ]

1 ACCEPTED SOLUTION

Accepted Solutions

I am not sure. But I guess it is not my wanting.

I attached exfiles.

Thank you very much for your effort for me

View solution in original post

25 REPLIES 25
MikeArmstrong
5-Regular Member
(To:jlee-2)

Please upload your worksheet. From the picture it seems you have a single column matrix.

I am going to use 'range variable' to do my work because I saw book about mathcad that it suggest user to use 'range variable' for iteration

and I am accustome to use 'range variable compared to 'vector'.

StuartBruff
23-Emerald II
(To:jlee-2)

I haven't got Prime and I'm not sure what you're trying to achieve, but if the intent is to show the last element of the vector, then can you simply drag the slider bar down the display until you reach the last element?

If you simply want a more compact display, and don't mind that it's shown as a matrix, then reshaping the vector into a matrix might help.

Stuart

collab+-+14+10+21+reshape+01.JPG

MikeArmstrong
5-Regular Member
(To:StuartBruff)

StuartBruff wrote:

I haven't got Prime and I'm not sure what you're trying to achieve, but if the intent is to show the last element of the vector, then can you simply drag the slider bar down the display until you reach the last element?

If you simply want a more compact display, and don't mind that it's shown as a matrix, then reshaping the vector into a matrix might help.

Stuart

collab+-+14+10+21+reshape+01.JPG

Good idea Stuart, but reshape requires a vector.

Mike Armstrong wrote:

StuartBruff wrote:

I haven't got Prime and I'm not sure what you're trying to achieve, but if the intent is to show the last element of the vector, then can you simply drag the slider bar down the display until you reach the last element?

If you simply want a more compact display, and don't mind that it's shown as a matrix, then reshaping the vector into a matrix might help.

Stuart

Good idea Stuart, but reshape requires a vector.

It's a shame that Mathcad Prime doesn't support a Mathcad 15 feature, namely the ability to enter a "range definition" (that is expressions of the form "a,b..c"). In M15, using my vec or seq functions, I can write, for example, x:= vec(0,0.1..1) and get back the vector [0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1], or even r:=0,0.1..1 , x:=vec(r) ... I think this last form might work, but I'm not sure.

Stuart

collab - 14 10 21 reshape 02.JPG

MikeArmstrong
5-Regular Member
(To:StuartBruff)

StuartBruff wrote:

It's a shame that Mathcad Prime doesn't support a Mathcad 15 feature, namely the ability to enter a "range definition" (that is expressions of the form "a,b..c").

It is a shame as I use both of those feature in the majority of cases when creating vectors.

StuartBruff wrote:

In M15, using my vec or seq functions, I can write, for example, x:= vec(0,0.1..1) and get back the vector [0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1], or even r:=0,0.1..1 , x:=vec(r) ... I think this last form might work, but I'm not sure.

Stuart

Correct, it does work in that format but does not look as neat.

1.bmp

2.bmp

MikeArmstrong
5-Regular Member
(To:jlee-2)

jinsuk Lee wrote:

I am going to use 'range variable' to do my work because I saw book about mathcad that it suggest user to use 'range variable' for iteration

Firstly it is your prerogative to use range variables if you so wish, but I would highly recommend using vectors.

and I am accustome to use 'range variable compared to 'vector'.

I'm sorry, but I just don't see it.

You have defined three range variables, one having more elements than the other two and passed them as arguments to omega. I cannot see what you are trying to do. I suggest you try and explain a little better. Are the calculated results what you expected?

Mike Armstrong wrote:

jinsuk Lee wrote:

I am going to use 'range variable' to do my work because I saw book about mathcad that it suggest user to use 'range variable' for iteration

Firstly it is your prerogative to use range variables if you so wish, but I would highly recommend using vectors.

and I am accustome to use 'range variable compared to 'vector'.

I'm sorry, but I just don't see it.

You have defined three range variables, one having more elements than the other two and passed them as arguments to omega. I cannot see what you are trying to do. I suggest you try and explain a little better. Are the calculated results what you expected?

I guess he wants tables like the one below (maybe without the row and colum headers) - one for every value of mu and without any use of vectors.

2.png

MikeArmstrong
5-Regular Member
(To:Werner_E)

Werner Exinger wrote:

Mike Armstrong wrote:

jinsuk Lee wrote:

I am going to use 'range variable' to do my work because I saw book about mathcad that it suggest user to use 'range variable' for iteration

Firstly it is your prerogative to use range variables if you so wish, but I would highly recommend using vectors.

and I am accustome to use 'range variable compared to 'vector'.

I'm sorry, but I just don't see it.

You have defined three range variables, one having more elements than the other two and passed them as arguments to omega. I cannot see what you are trying to do. I suggest you try and explain a little better. Are the calculated results what you expected?

I guess he wants tables like the one below (maybe without the row and colum headers) - one for every value of mu and without any use of vectors.

2.png

Your crystal ball working again

Great assumption, but yet again we are guessing. Jinsuk Lee has not even responded to this thread, which he should have before creating a new one. http://communities.ptc.com/message/260284#260284

Your crystal ball working again

Great assumption, but yet again we are guessing. Jinsuk Lee has not even responded to this thread, which he should have before creating a new one. http://communities.ptc.com/message/260284#260284

He hadn't resonded to other threads, too. He is jumping from one question to the other in quick succession, doesn't let us know if what we guess is what he needs and he consequently ignores our advice. Of course it could also be that Google Translate's Korean is so confusing he often can't follow our remarks.

Maybe its frustrating for both sides - a loose-loose situation, so to say.

I am sorry to not respond to your advice.

Actually, I didn't intend to ignore your advice.

I tried to express 'vector' for my work. But I got error continually so I gave up by using 'vector'

I know if I use 'vector', I need to make same matrix about columns and raws. if I don't, I continually got errors.

But My variables's columns and raws isn't same.

MikeArmstrong
5-Regular Member
(To:jlee-2)

2.png

Is what Werner posted what you wanted?

I am not sure. But I guess it is not my wanting.

I attached exfiles.

Thank you very much for your effort for me

MikeArmstrong
5-Regular Member
(To:jlee-2)

So do you want the same results shown in the Excel table produced in Mathcad.

If you can show an example of the results you want to calculate we should be able to help.

I am sorry but I don' understand well.

what is the examle of the results?

Is it my file in mathcad that I attached a few of days?

MikeArmstrong
5-Regular Member
(To:jlee-2)

Is it an example of what you want at the end of your calculation. You do not have to calculate these, just manually type them out if you can.

I am sorry again. I can't understand what you mean.

But I tried to guess

My excel file is a parial work that I want to solve.

I just wonder that how I can express by using 'vector' to get result in excel.

I can do to get result value by using ' range variable'

But I can't do it by using 'vector'

StuartBruff
23-Emerald II
(To:jlee-2)

jinsuk Lee wrote:

I am not sure. But I guess it is not my wanting.

I attached exfiles.

Thank you very much for your effort for me

Ah, you mean something like the attached? Note the use of nested arrays to hold all of your data - get at each 'table' by indexing as you would normally. I gave the definition of seq in another message - or you could import the attached M14 worksheet.

Stuart

collab+-+14+10+22+JK+01.JPG

Werner_E
24-Ruby V
(To:jlee-2)

I am not sure why this reply of yours is the correct answer, but as long as you are happy we should be so, too, I guess 😉

Just to round things up: In the initial posting of yours you showed a picture of a function with three arguments and you called it with the third argument mu as a constant (2/29) and the other two argument as ranges with 9 "elements" each. You wanted the outcome not to be a list but a matrix, which obviously could only be the 9x9 matrix.

Now you attach an excel sheet, where you show a different function (its yours multiplied by 57) and different ranges for those three variables (a and a' run from 0 to 1 and mu also up to 1). So we see 11 tables one after the other, where a ist constant (not mu) and mu are the rows and a' the columns. So thats 11 19x11 matrices you seem to be looking for. Quite different from what you had asked at the beginning, isn't it?.

Its easy to create that structure with Mathcad, too (with ranges or vectors as arguments, whatever you are accustomed to 😉 But the question still is how you would like those matrices be presented. Two possibilties come to my mind - either a (nested) vector consisting of the 11 matrices, or a big n*11 matrix, where all 11 matrices are stacked one on top of the other. Her you would need some sort of divider, maybe also row and column headers, otherwise it would be just a big mess.

Which appraoch is better or appropriate depends on what you will use those tables for.

You former questions suggest that you just want to look up some combinations of values where the table value will exceed a certain threshold. If thats true it might be a better idea not to show those tables at all and let Mathcad do the lookup and just present you with the results.

Anyway, the following might help, but maybe it doesn't.

First we create a function which tables a function with three arguments, so that the result is a nested array consisting of a vector of matrizes. Ever of those matrices shows the function values whith constant third argument z and x as rows and y as columns.

1.png

This routine can be used with either vectors or your beloved ranges as arguments 😉

2.png

You may also use the same routine with vectors:

3.png

The benefit of using vetcors is very small to none here. Unfortunately Prime does not allow it the more easy and natural way. (Did we already asked for multidimensional arrays?)

4.png

StuartBruff
23-Emerald II
(To:Werner_E)

Werner Exinger wrote:

...

The benefit of using vetcors is very small to none here. Unfortunately Prime does not allow it the more easy and natural way.

It's possible to make life a bit easier by using a redefined matrix function that can take vector inputs for m and n. Given that we have a three-argument function, then for a fixed value of one argumen, we can create an auxiliiary two-argument function and apply the new matrix to it and the remaining two arguments.

collab+-+14+10+22+JK+02.JPG

where a, ap (a') and mu are as defined in your screenshot or my previous one.

Werner Exinger wrote:

...(Did we already asked for multidimensional arrays?)

4.png

Have we already asked for multidimensional arrays (MDAs)? Hmm, not sure that we have ... Oh, my goodness, it seems that we *have* asked, but only about a gazillion to the power of aleph-0 times.

I've also had the occasional moan about the poor support for nested arrays. In fact, by sheer coincidence, I've commented on the PTC blog about the new OBDC functions for Prime. There is so much multidimensional data out there, with fairly common processing needs, that there must surely be a considerable business case for implementing MDAs.

Stuart

Thank you for help.

I will try to understand by coding

Thank you for helping me.

Actually ,I can't understand well.

But I will try.. thank you

Fred_Kohlhepp
23-Emerald I
(To:jlee-2)

Mathcad cannot handle three index matruices easily.

Attached will create your table.

StuartBruff
23-Emerald II
(To:jlee-2)

jinsuk Lee wrote:

I am sorry to not respond to your advice.

Actually, I didn't intend to ignore your advice.

I tried to express 'vector' for my work. But I got error continually so I gave up by using 'vector'

I know if I use 'vector', I need to make same matrix about columns and raws. if I don't, I continually got errors.

But My variables's columns and raws isn't same.

A matrix doesn't need to be square (that is, have the same number of columns and rows) - it can be rectangular.

Are you describing a different situation, eg where you have a number of vectors each of different lengths? If so, then it might be possible to solve your problem using nested arrays, that is each element of a vector (or matrix) can be another vector (or matrix) - which in turn can also have elements that are arrays.

Stuart

collab+-+14+10+22+arrays+01.JPG

StuartBruff
23-Emerald II
(To:jlee-2)

... although, I suppose the image below better shows the existence of "ragged" arrays ....

Stuart

collab+-+14+10+22+arrays+01.JPG

Top Tags