Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
I would like to create a table where one of the columns was a calculation that involved items in multiple rows of another column. For example on column had gear ratios and another had the split between adjoining gears.
It is possible to reference another column and an entry in the top row populates (but doesn't display) the values in the other cells of that column. Is there a way to reference a cell in a different row from within a table?
The documentation on tables in Mathcad Prime is next to non-existent.
Is it possible to have a table display all values and not just the calculation equation in the top row?
You mean something like this?
The issues is if the first column is N, the second column is M, the third column is P equal to M*Nn /Nn+1. This could be gear ratios and the ratio between ratios.
Is there a way to do relative addressing?
The second is that in a document it would be desirable to display the values in the table, not just the equation. After all, is the document for presentation and tables a way to enhance that?
David Ziegelheim wrote:
The issues is if the first column is N, the second column is M, the third column is P equal to M*Nn /Nn+1. This could be gear ratios and the ratio between ratios.
Is there a way to do relative addressing?
OK. What I suspect you're really after is a "spreadsheet" way of relating the columns; that is, writing an expression for the value of P in each "cell" of the table, where the expression depends upon the "row number" of elements in another column, and then displaying the result rather than the expression??
If so, then the answer is that you can't as that as a table isn't actually a spreadsheet-like table. As stated above, a table is just another way of writing a set of (possibly related) Mathcad statements. So anything (well, almost anything) you can write in Mathcad normally, should be capable of being written in a table. So, in your particular example, we'd have:
As Luc points out, a Mathcad table is just an alternative form for Input of expressions; Mathcad does not allow you to output data in table form. So once you've got the data, you have to find an alternative method of formatting the data how you'd like it. I occasionally have the need to display data in tabualar format with heading; when I do I either use Excel or a simple Table function like the one below (transcribed from Mathcad 15 into Express (which lacks programming)).
(Note that I had to manually adjust the size of P to make it equal in length to N ... the advantage of Excel (and the new Prime table input method) is that I don't have to worry about that particular detail)
Stuart
David Ziegelheim wrote:
I would like to create a table where one of the columns was a calculation that involved items in multiple rows of another column. For example on column had gear ratios and another had the split between adjoining gears.
It is possible to reference another column and an entry in the top row populates (but doesn't display) the values in the other cells of that column. Is there a way to reference a cell in a different row from within a table?
The documentation on tables in Mathcad Prime is next to non-existent.
Is it possible to have a table display all values and not just the calculation equation in the top row?
Following on from Luc's reply, it appears as if a Prime Table is effectively a shorthand method of defining a set of variables, where each variable can be a scalar, array or function. Prime evaluates a table in the the standard left-right fashion, but does it column-wise. This means that in any given column you can reference any variables (columns) defined to the left of it in a Table, but not any defined to the right. You can independently reference any element of a variable as per a normal array.
I don't know whether this is documented anywhere .. I just had a play with it.
Stuart
With regards to documentation, just look it up in the help:
And so, I think this is what you want:
Success!
Luc
LucMeekes wrote:
With regards to documentation, just look it up in the help:
And so, I think this is what you want:
Success!
Luc
Hi Luc,
Unfortunately, I don't think that the documentation makes it clear what's going on in a table definition. It (to me, at least) gives the impression that the columns must be scalars and does not make it clear that there is a left-right column order for definitions or that operations can be carried out on "already defined" variables (Table columns). There was a bit more in my original worksheet pointing out that a Table treats a single element in a column as being a normal definition, rather than as a single-element vector. I've updated the worksheet to show how to define a single-element array using Table.
Stuart
Oops! The text just before the definition of h should read "In the table below, ..." and not "In the table to the left, ...". I forgot to change it after extending the Table to show the single-element array definitions.
Stuart
Hi Stuart,
From reading the help text, I (implicitly) assumed that the table is nothing more than an assembled set of variable definitions, mostly geared towards actually producing a(n input) table from column vectors. Hence my first (clumsy) example.
Especially with the remark that all possibilities of operations on/with table columns are the same as on column vectors made me stop worrying and just treat a table as a row (left to righ) of vector definitions, with the (again implicit) assumption that table elements can reference items to their left.
It wasn't until I saw your first experiments that I realized that table elements could be scalars and vectors mixed, that's nice.
The help for Prime states that tables can only be used for Input. If you want Output in a table-like form, you'll have to assemble a matrix from the vectors, but then you must be sure to fill the entire rectangle of the matrix. Fortunately matrix elements can have mixed units in Prime...
Luc