I need some help with this Python assignment. I need some help with a python assignment. Assignment 6 - Arrays and Matri
Posted: Fri Jul 01, 2022 5:35 am
I need some help with this Python assignment.
I need some help with a python assignment.
Assignment 6 - Arrays and MatricesObjective
Use matrix methods to solve engineering problems using Python and Numpy
Assignment
Here is the classic case truss example.
You will be solving for the maximum compression and tension Force on one of the members of the truss. The truss problem you will solve is linked here.
Below is an example of a truss problem that you can use to help you do the calculations for the problem you will complete. This is NOT the truss to solve for the problem. It is an example you can use to figure out how to solve this. You CAN discuss approaches freely on the discussion boards.
Howe Truss
The upward forces at A can be calculated by taking a summation of the moments at E
Moment is distance * force
Moment at E = 0 = 40*4 + 20*8 + 20*12 + 30*16 - FA * 16
FA = 65 kNSimilarly FE = 45 kN
With this information we can do Sum of Forces in X and Y at each node to generate the matrix
Members (17): AJ, AI, AB, BI, BH, BC, CH, CD, DH, DG, DE, EG, EF, JI, IH, HG, GF
You will need 17 equations to solve for the forces in each of these members.
Solve this problem using a matrix solution and report the maximum compression member and value and the maximum tension member and value.
Information
The most challenging part will be determining the force vectors which will involve summing the Force in X and Force in Y at the joints.
XqY - Youtube video of solving the Classic Truss problem.
You may freely write the Summation of Force Equations for the members and discuss these equations. You will not need to use all available equations (Sum forces and sum of moments) to solve for all the force members. You must write a program to solve the problem which will involve using the geometries to set up the matrix and Python and Numpy to solve the matrix for the forces.
If you are having trouble figuring out how to write the force equations, the discussion board is a great place to ask questions. Everyone should be familiar with at least basic matrix algebra based on the pre-requisites of the course.
Here is the classic case truss example. A C You will be solving for the maximum compression and tension Force on one of the members of the truss. The truss problem you will solve is linked here. 30 kN Below is an example of a truss problem that you can use to help you do the calculations for the problem you will complete. This is NOT the truss to solve for the problem. It is an example you can use to figure out how to solve this. You CAN discuss approaches freely on the discussion boards. Howe Truss B D 20 kN 20 kN H mb C 16 m, 4@4m- E 40 kN Moment is distance force D F T 4 m E The upward forces at A can be calculated by taking a summation of the moments at E
Additional Help Since you will be working with a large matrix - it is sometimes easier to edit the matrix by itself as a text file in csv format. Excel is also good and can save files as a csv (or comma delimted). My csv file looks something like this; -1,0, -0.707, 0, 0, 0, 0, -0.707, 0,-1, 0, 0, 0.707, 1, 0, 0, 1, 0.707, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0, 0, 1, 0, 0,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-1, 0, -0.707, 0, 0, 1, -0.707, 0, 0, 0, 0.707, 0, 0, 0, 0.707, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Of course - if you do this you will need to be able to read this into the program as a matrix - so here is
Of course if you do this you will need to be able to read this into the program as a matrix - so here is some code using the pandas library to make that easy. Note: You cannot simply copy and paste this into your code, this is specifically the order and assumptions I made when solve the problem and the columns correspond with nodes that must correspond with the other 2 arrays. import pandas "We will use the pandas function. read_csv to bring the data in as a dataframe" df = pandas.read_csv( r"C:\Users\eaglinr\Documents\classes\EG N3214\trussdata2.csv", sep=",", dtype=float) "We need it as a matrix for algebra which can be done with the tolist() function" values=df.values.tolist() It is worth looking at the pandas library which does have the ability to directly read from an Excel file Lamong other formate) If you were to use Excel your
I need some help with a python assignment.
Assignment 6 - Arrays and MatricesObjective
Use matrix methods to solve engineering problems using Python and Numpy
Assignment
Here is the classic case truss example.
You will be solving for the maximum compression and tension Force on one of the members of the truss. The truss problem you will solve is linked here.
Below is an example of a truss problem that you can use to help you do the calculations for the problem you will complete. This is NOT the truss to solve for the problem. It is an example you can use to figure out how to solve this. You CAN discuss approaches freely on the discussion boards.
Howe Truss
The upward forces at A can be calculated by taking a summation of the moments at E
Moment is distance * force
Moment at E = 0 = 40*4 + 20*8 + 20*12 + 30*16 - FA * 16
FA = 65 kNSimilarly FE = 45 kN
With this information we can do Sum of Forces in X and Y at each node to generate the matrix
Members (17): AJ, AI, AB, BI, BH, BC, CH, CD, DH, DG, DE, EG, EF, JI, IH, HG, GF
You will need 17 equations to solve for the forces in each of these members.
Solve this problem using a matrix solution and report the maximum compression member and value and the maximum tension member and value.
Information
The most challenging part will be determining the force vectors which will involve summing the Force in X and Force in Y at the joints.
XqY - Youtube video of solving the Classic Truss problem.
You may freely write the Summation of Force Equations for the members and discuss these equations. You will not need to use all available equations (Sum forces and sum of moments) to solve for all the force members. You must write a program to solve the problem which will involve using the geometries to set up the matrix and Python and Numpy to solve the matrix for the forces.
If you are having trouble figuring out how to write the force equations, the discussion board is a great place to ask questions. Everyone should be familiar with at least basic matrix algebra based on the pre-requisites of the course.
Here is the classic case truss example. A C You will be solving for the maximum compression and tension Force on one of the members of the truss. The truss problem you will solve is linked here. 30 kN Below is an example of a truss problem that you can use to help you do the calculations for the problem you will complete. This is NOT the truss to solve for the problem. It is an example you can use to figure out how to solve this. You CAN discuss approaches freely on the discussion boards. Howe Truss B D 20 kN 20 kN H mb C 16 m, 4@4m- E 40 kN Moment is distance force D F T 4 m E The upward forces at A can be calculated by taking a summation of the moments at E
Additional Help Since you will be working with a large matrix - it is sometimes easier to edit the matrix by itself as a text file in csv format. Excel is also good and can save files as a csv (or comma delimted). My csv file looks something like this; -1,0, -0.707, 0, 0, 0, 0, -0.707, 0,-1, 0, 0, 0.707, 1, 0, 0, 1, 0.707, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0, 0, 1, 0, 0,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-1, 0, -0.707, 0, 0, 1, -0.707, 0, 0, 0, 0.707, 0, 0, 0, 0.707, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Of course - if you do this you will need to be able to read this into the program as a matrix - so here is
Of course if you do this you will need to be able to read this into the program as a matrix - so here is some code using the pandas library to make that easy. Note: You cannot simply copy and paste this into your code, this is specifically the order and assumptions I made when solve the problem and the columns correspond with nodes that must correspond with the other 2 arrays. import pandas "We will use the pandas function. read_csv to bring the data in as a dataframe" df = pandas.read_csv( r"C:\Users\eaglinr\Documents\classes\EG N3214\trussdata2.csv", sep=",", dtype=float) "We need it as a matrix for algebra which can be done with the tolist() function" values=df.values.tolist() It is worth looking at the pandas library which does have the ability to directly read from an Excel file Lamong other formate) If you were to use Excel your