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

Using Range Variables to Create a Matrix?

kwadley
1-Visitor

Using Range Variables to Create a Matrix?

I'm trying to define a variable (shown as 'n' below) that will create a matrix of 'n' columns and subsequently use the values in the matrix to perform arithmetic operations:

Question.PNG

Thanks,

Kevin

10 REPLIES 10
MJG
18-Opal
18-Opal
(To:kwadley)

I don't think it's possible to do exactly what you want in Prime.  There is a solution in Mathcad 15 (& prior) using scripted components.

Here's my stab at a best solution for you in Prime:

Werner_E
25-Diamond I
(To:kwadley)

> I'm trying to define a variable (shown as 'n' below) that will create a matrix of 'n' columns

This sure should be no problem

> and subsequently use the values in the matrix

You will have to tell us, how those values depend on n

It looks like h_i=i*2 in, right? But what about the values of n_i ?

> to perform arithmetic operations:

Again - should be no problem.

So all what remains is that you specify the values of your matrix.

R

It's not clear to me why you're working so hard!  define a vector of lengths and a correlating vector of numbers.  (You had to type those in, right?)  Then vector math is simple:

StuartBruff
23-Emerald III
(To:kwadley)

Just a variant on the already proferred suggestions ...

Stuart

kwadley
1-Visitor
(To:kwadley)

Thanks all for the replies!

Looks like I need to give a little background:


I am trying to create a BLANK matrix of elements based on the number of rows of items I have, but the number of rows is not a constant from one design to the next.  To clarify, the values of 'n' & 'h' are totally independent and do NOT depend on the number of rows, i.e., my range variable.

where      n = number of items/row (or total area if each has an area of 1)

                h = height of row from a horizontal reference


So, my worksheet is calculating the center of gravity of my items which all have the same area.


LucMeekes
23-Emerald III
(To:kwadley)

With BLANK matrix, do you mean an empty matrix?

Then look here Variable sized vectors and matricies where the components can be edited by the user.

Or do you mean to create a matrix filled with 0's. like:

Success!
Luc

Kevin Wadley wrote:

Thanks all for the replies!

Looks like I need to give a little background:


I am trying to create a BLANK matrix of elements based on the number of rows of items I have, but the number of rows is not a constant from one design to the next.  To clarify, the values of 'n' & 'h' are totally independent and do NOT depend on the number of rows, i.e., my range variable.

where      n = number of items/row (or total area if each has an area of 1)

                h = height of row from a horizontal reference


So, my worksheet is calculating the center of gravity of my items which all have the same area.


But you don't have to create a blank matrix!

You have two vectors, n and h; as long as they each have the same number of elements (and if they're based on rows they should), then you can work directly with these two vectors--no matrix required.  You can type the vectors in, you can read a file, you can embed an EXCEL sheet--any way you get the vectors is fine and works.  You can even create a function that takes two vectors (of any length as long as they're the same length) and calculates the CG.

kwadley
1-Visitor
(To:kwadley)

Mark & Luc-

The link you provided IS the solution I'm looking for.  However, as Mark pointed out, I AM using Mathcad Prime.  Can I do this in Prime?

FYI, I'm still a novice user.  I'm learning more everyday, but I am not really sure how to follow the example.  Where is the code for the 'Define Matrix' button, and is this written in Mathcad?  If I right click on the button and select 'Edit Script', a text editor pops up?  Also, does the hidden area entitled 'Utilities' above this button have anything to do with the matrix generator?

Kevin

StuartBruff
23-Emerald III
(To:kwadley)

Kevin Wadley wrote:

Mark & Luc-

The link you provided IS the solution I'm looking for.  However, as Mark pointed out, I AM using Mathcad Prime.  Can I do this in Prime?

No.  Not until (at least) version Prime 4.0.  Prime 3.1 lacks components.

The link you provided IS the solution I'm looking for.  However, as Mark pointed out, I AM using Mathcad Prime.  Can I do this in Prime?

Where is the code for the 'Define Matrix' button, and is this written in Mathcad?  If I right click on the button and select 'Edit Script', a text editor pops up? 

When you click "Edit Script", you are presented with the code for the Define Matrix button.  It is written in VBScript.

Also, does the hidden area entitled 'Utilities' above this button have anything to do with the matrix generator?

No.

Getting back to your original problem, why do you need to create the matrix?

Stuart

RichardJ
19-Tanzanite
(To:StuartBruff)

No.  Not until (at least) version Prime 4.0.  Prime 3.1 lacks components.

IIRC Prime 4.0 will not have components either. So that is at least a year and a half away.

Announcements

Top Tags