Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline register  
#1 Posted : 07 May 2011 04:37:11(UTC)
register

Rank: Newbie

Groups: Registered
Joined: 07/05/2011(UTC)
Posts: 2
Location: San Francisco, CA

I'm using Smath to design a gear train. I have a few questions about the use of matrices that I haven't been able to find the answers to on the forum:

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

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline omorr  
#2 Posted : 09 May 2011 10:35:06(UTC)
omorr


Rank: Administration

Groups: Registered, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,740
Man
Serbia

Was thanked: 318 time(s) in 268 post(s)
Hello Henry,
register wrote:
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?

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
Open in SMath Cloud
register wrote:
2. ....
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:
Open in SMath Cloud
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)
register wrote:
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?

I think that the same is with this question - just try multiline definition of variables and functions
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)
res1=mat(4,9,11,8,18,22,12,27,33,3,3)
register wrote:
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

I did not understand this, sorry.

Although I did not understood quite well all of you questions,I hope this would help.

Regards,
Radovan

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline register  
#3 Posted : 09 May 2011 15:58:50(UTC)
register

Rank: Newbie

Groups: Registered
Joined: 07/05/2011(UTC)
Posts: 2
Location: San Francisco, CA

Thanks for taking the time to answer my questions Radovan.

Your answer to the 2nd question has actually also answered the fourth question for me.

Regards,
Henry
Offline omorr  
#4 Posted : 09 May 2011 23:31:38(UTC)
omorr


Rank: Administration

Groups: Registered, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,740
Man
Serbia

Was thanked: 318 time(s) in 268 post(s)
You are welcome Henry,

Just do not hesitate to ask anything you like about SMath, and have fun by using it Good

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline TheWizEd  
#5 Posted : 11 May 2011 23:06:43(UTC)
TheWizEd


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2010(UTC)
Posts: 178
Man
United States

Was thanked: 19 time(s) in 13 post(s)
Henry,

Not sure if this is what you were asking about but you can put equations in a matrix.

Open in SMath Cloud

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 Clapping

Edited by user 11 May 2011 23:09:58(UTC)  | Reason: Not specified

Ed
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.