A Few Questions About Matrices - Messages
Here's an example of one matrix that I'm using for this task:

This matrix is governed by a set of equations (not pictured). I use the following expressions to populate the matrix:

Here are my questions:
1. The column labeled "T" is a column of torque values for different gears. Smath won't simplify the units from kg*m^s/s^s to N*m on its own. I've run into this before when writing out equations, but have always been able to delete the units and replace them with my simplified version. In the matrix, any attempt to modify a cell causes the matrix to collapse and is not allowed. Is there a way to force a column to display certain units?
2. This builds on the first: in a matrix with several columns defined by expressions like those shown in the second picture, is there any way to write specific expressions into one column? For example, the ω column represents angular velocity. Different gears have different equations for their angular velocities, so I've had govern them with the following equations:

I then created a matrix called ω (visible in the second image) and stored the results in it, which I then inserted into the matrix called "result1." Instead, I'd like to put all the equations directly into "result1" without having to use the secondary "ω" matrix and the loose equations, but when I try to type anything into the pre-existing matrix, it collapses and won't let me enter anything. Is the only way to do this by defining the size of the matrix before I enter anything into it?
3. Is there a way to simplify the "for k ∈ 1..." expressions in the second image? I copied the original syntax from one of the example files called "GravitationAcceleration.sm" and am having trouble understanding how I'd write the expression from scratch, and more specifically if it is possible to use a single "for k ∈ 1..." expression followed by a series of el(result1,k,2)←d.p(el(data,k,2)) expressions?
4. Is it possible to populate a single cell of a matrix from an equation? For example, if I had a 3x3 matrix called "matrix," would it be possible to define something like "matrix.3,2 := (4*9)3x" so that if x were to change the matrix location (3,2) would automatically update to the result of the equation? I've searched the excellent .pdf that Dr. Urroz produced but can't find anything exactly like it
Thank you for any help you can offer on any or all points. This is a great program and a resource that I'm grateful for!
Regards,
Henry
Wrote1. The column labeled "T" is a column of torque values for different gears. Smath won't simplify the units from kg*m^s/s^s to N*m on its own. I've run into this before when writing out equations, but have always been able to delete the units and replace them with my simplified version. In the matrix, any attempt to modify a cell causes the matrix to collapse and is not allowed. Is there a way to force a column to display certain units?
As far as I know, there is no way to simplify or to change units of matrix elements. You can just extract and display a row or column and change the units for the entire row/column
[LIVE width=343 height=192]http://smath.info/live/?file=2718[/LIVE]
Wrote2. ....
I then created a matrix called ω (visible in the second image) and stored the results in it, which I then inserted into the matrix called "result1." Instead, I'd like to put all the equations directly into "result1" without having to use the secondary "ω" matrix and the loose equations, but when I try to type anything into the pre-existing matrix, it collapses and won't let me enter anything. Is the only way to do this by defining the size of the matrix before I enter anything into it?
I am not sure if I understood this well, but here is something you can use - multiline definitions:
[LIVE width=424 height=408]http://smath.info/live/?file=2720[/LIVE]
Inside the line() environment you can define some calculation and matrix "result" will receive the value of the variable in the last line ("together" in this case). Any defined variables inside line() (i, name, first, second, together in this case) are locally defined and not known outside that line. But inside line you can get the variables defined outside that line() (nrow in this case)
Wrote3. Is there a way to simplify the "for k ∈ 1..." expressions in the second image? I copied the original syntax from one of the example files called "GravitationAcceleration.sm" and am having trouble understanding how I'd write the expression from scratch, and more specifically if it is possible to use a single "for k ∈ 1..." expression followed by a series of el(result1,k,2)←d.p(el(data,k,2)) expressions?
I think that the same is with this question - just try multiline definition of variables and functions
[MATH=eng]res1←line(for(k,range(1,3),line(el(res,k,1)←4*k,el(res,k,2)←9*k,el(res,k,3)←11*k,3,1)),res,2,1)[/MATH]
[MATH=eng]res1=mat(4,9,11,8,18,22,12,27,33,3,3)[/MATH]
Wrote4. Is it possible to populate a single cell of a matrix from an equation? For example, if I had a 3x3 matrix called "matrix," would it be possible to define something like "matrix.3,2 := (4*9)3x" so that if x were to change the matrix location (3,2) would automatically update to the result of the equation? I've searched the excellent .pdf that Dr. Urroz produced but can't find anything exactly like it
I did not understand this, sorry.
Although I did not understood quite well all of you questions,I hope this would help.
Regards,
Radovan
Your answer to the 2nd question has actually also answered the fourth question for me.
Regards,
Henry
Just do not hesitate to ask anything you like about SMath, and have fun by using it

Regards,
Radovan
Not sure if this is what you were asking about but you can put equations in a matrix.
[LIVE width=170 height=366]http://smath.info/live/?file=2735[/LIVE]
SMath works top down. Not like Excel that links cells. Note the first time I inquire about x its undefined. Then when I change y the results change. A note of caution. If I had defined y before x the values of x would be constant.
Another note for you. If the matrix is a vertical vector you only need to provide the first index i.e. result1[k,4:=w[k
Today I also learned how to link SMath Live to the forum. Neet

-
New Posts
-
No New Posts