Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
9 views

Utilizing Python as an Effective Solver for Equations in Structural Analysis

This paper evaluates the effectiveness of using Python, specifically the NumPy and SciPy libraries, for solving equations in structural analysis. The authors demonstrate that Python-based solutions are accurate, efficient, and cost-effective compared to traditional commercial software, making it a viable option for engineers. The study covers various methods of analysis for statically indeterminate structures, confirming Python's utility in achieving high numerical precision and fast execution times.

Uploaded by

Musa Abdul
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Utilizing Python as an Effective Solver for Equations in Structural Analysis

This paper evaluates the effectiveness of using Python, specifically the NumPy and SciPy libraries, for solving equations in structural analysis. The authors demonstrate that Python-based solutions are accurate, efficient, and cost-effective compared to traditional commercial software, making it a viable option for engineers. The study covers various methods of analysis for statically indeterminate structures, confirming Python's utility in achieving high numerical precision and fast execution times.

Uploaded by

Musa Abdul
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Hummingbird Publications © Dec.

HP
Journal of African Resilience & Advancement Research JARAR2023 [E-ISSN 3027-1347 P-ISSN 3027-043X] Vol. 2
Journal of African Resilience & Adv. Research 2023
www.hummingbirdjournals.com Vol. 2 No. 2
JARAR2023

Utilizing Python as an Effective Solver for Equations in


Structural Analysis

Musa Abdul1 and Muhammed Tuga Bawa2


1
Department of Building, College of Environmental Studies, Kaduna Polytechnic,
Kaduna. 2Department of Building, Faculty of Environmental Sciences, Baze
University, Abuja.
musaabdul@kadunapolytechnic.edu.ng

Keywords: python,
solver, equations, Abstract
structural analysis, Computers are used to accurately represent the behaviour of
NumPy, SciPy real structures. Python is a powerful programming language
that has become a popular choice for developing computer
algorithms and built-in solvers for various categories of
equations and numerical problems. This paper aims to
evaluate the effectiveness of using Python to solve
equations in structural analysis. To do this, a set of test cases
representing real-world structures is created and analyzed.
Results were obtained from different methods of analysis
on the same problem case. The results obtained from the
different methods were the same. The overall accuracy and
speed of the Python-based solutions are then evaluated and
discussed. The tests cover the structural configurations of
statically indeterminate structure, which comprise the
analysis of continuous beam supporting uniformly
distributed load and several point loads. The following
methods were applied: force method, three-moments-
equation, and slope-deflection method. The equations
derived from the different methods were solved using the
Python popular packages: NumPy and SciPy. Results show
that Python is an effective and efficient tool for solving
equations in structural analysis. The Python-based solutions
are accurate with high numerical precision and very fast
execution period. Overall, this paper provides evidence that

Page 64 JARAR Vol. 2 (2) 2023 E-ISSN 3027-1347 P-ISSN 3027-043X


Journal of African Resilience & Advancement Research JARAR2023 [E-ISSN 3027-1347 P-ISSN 3027-043X] Vol. 2

Python is a useful tool for engineers to solve equations


quickly and accurately in structural analysis. The findings
suggest that Python should be considered a viable and
attractive option when computational speed and accuracy
are essential in engineering projects.

Introduction
Structural analysis involves solutions to various kinds of equations including ordinary
and partial differential equations. Most of these equations are complex and require
special packages for solutions. Most of the available packages are commercial and
expensive. There is a need for efficient and cost-effective solutions. Not only is Python
and its support packages efficient, and cost-effective, they are freely available for use
and at no cost. Their provisions are open source, everyone can download and use. The
packages used for this project alongside Python are NumPy (numerical python) and
SciPy (scientific python). Bressert (2013) described Python as a highly flexible high-
level programming language with easy to read syntax and an ideal language to learn
and use. A few extra packages, such as Scipy and Numpy are used to streamline the
development process for Science and reasearch and development (R & D).
According to (Quraishi & Dhapekar, 2021), Python is an advanced open source
programming language which is widely utilized by software engineers across the
world for different applications. It is accessible for free and can work effectively on
PCs and can be setup with little or no configuration. Commercial software have been
utilized in the analysis and design of reinforced concrete and other Building and Civil
Engineering structures. The cost of the commercial software hinders their wider
applications, as most organisations acquire only a limited quantity for a few staff of
the organisation. Individuals with little or no programming background can easily
understand and immediately commence utilizing Python in their projects.
According to Harris et al. (2020) NumPy is a community-developed, open-source
library, which provides a multidimensional Python array object along with array-
aware functions that operate on it. Because of its inherent simplicity, the NumPy array
is the de facto exchange format for array data in Python. According to (Lemenkova,
2019), NumPy enables various object-oriented approach, mathematical and logical
manipulations with table using ndarray. Boulle & Kieffer (2019) stated that, python,
together with its associated librabries, Numpy and Scipy, has become the standard for
scientific and engineering computing in different fields. This popularity is mainly due
to the ease with which a Python program can be written and executed coupled with the
existence of a large number of specialized third-party libraries that aim to lift all the
limitations of the raw Python language. NumPy introduces vector programming,

Page 65 JARAR Vol. 2 (2) 2023 E-ISSN 3027-1347 P-ISSN 3027-043X


Journal of African Resilience & Advancement Research JARAR2023 [E-ISSN 3027-1347 P-ISSN 3027-043X] Vol. 2

improving execution speeds, where as SciPy brings a wealth of highly optimized and
reliable scientific functions.
Waheed Kadhim et al. (2022) described SciPy an open-source library for scientific
computing built on top of the Python programming language. Its access and use is free.
Since its initial release in 2001, SciPy has established itself as the industry standard
for implementing scientific algorithms in Python and witnessed millions of annual
downloads. Both NumPy and SciPy can be used to solve equations. According to
(Virtanen et al., 2020), SciPy is a library of numerical routines for the Python
programming language that provides fundamental building blocks for modeling and
solving scientific problems. SciPy includes algorithms for optimization, integration,
interpolation, eigenvalue problems, algebraic equations, differential equations and
many other classes of problems.
The aim of this paper is to apply NumPy and SciPy as equation solvers in Python to
solve equations from different methods of analysing statically indeterminate
structures. To achieve this, solvers from the two different packages were used. To test
their efficiency and effectiveness, results from the two different approaches were
compared and at the same time, the results obtained from the different methods of
structural analysis were compared. Further comparison was carried with pre-
determined results of the case under study.

Python Programming Language


Block of code structure is created using indentation in Python. Indent one level, in, for
the beginning of a block and indent, out, to show end of the block. Python can be
downloaded for free at https://python.org/downloads/. Installing Python automatically
installs with it, IDLE (Integrated Development and Learning Environment) an IDE
(Integrated Development Environment) for executing Python programmes. The
following are the defined data types in Python: int (for integers), float (for numbers
with decimal points), str (for characters), list(for collection of values), tuple (for
unmodifiable collection of values), set(for non duplicate collection of values), dict (for
key:value pairs collection of values) and bool(for true or false values). Python is
object-oriented programming language. Method or functions are defined using the
“def” keyword and class definition is with the keyword, “class”.
(Stewart & Mommert, 2023,Kuhlman, 2013,Zemkoho, 2023,Mehare et al.,
2023,Wang & Wang, 2023,Mehare et al., 2023,Kaufmann & Held, 2023& J.
Goldbaum et al., 2018)

NumPy and SciPy


NumPy is the fundamental package for scientific computing in Python. It provides a
multidimensional array object, various derived, and an assortment of routines for fast
Page 66 JARAR Vol. 2 (2) 2023 E-ISSN 3027-1347 P-ISSN 3027-043X
Journal of African Resilience & Advancement Research JARAR2023 [E-ISSN 3027-1347 P-ISSN 3027-043X] Vol. 2

operations on arrays. NumPy has packages dealing with different fields as aspects.
The main data type of NumPy is the N dimensional array (ndarray) object. NumPy has
support packages for matrix, polynomial, set, statistics, linear algebra, and much more.
The linear algebra functions provide efficient low-level implementations of standard
linear algebra algorithms, which include matrices and solution to simultaneous linear
equations. The NumPy library has other specialised packages for specific and special
tasks and activities. Installation of NumPy is simple. It is installed by this command:
pip install numpy. (Idris, 2012,Harris et al., 2020,Pawlik et al., 2015,Waheed Kadhim
et al., 2022,Lynch, 2023,Lemenkova, 2019)
SciPy is a collection of mathematical algorithms and convenience functions built on
NumPy . It enhances the capability and power of Python by the provision of the ability
to analysis data, solve equations and manipulate and visualize data. It provides utility
functions for optimisation, statistics, and signal processing. Scipy is installed by this
command: pip install scipy. (Hill, 2016, Martins et al., 2017, Blanco-silva,
2015,DataCamp, 2015,Virtanen et al., 2020 & Santos, 2015)

Structural Analysis
Structural analysis involves the assessment of structures under loads application. In
this paper, only the analysis of statically indeterminate structures were considered, i.e.
structures where equilibrium equations are insufficient for their complete analysis.
Three methods of analysis discussed: are: three-moments-equation method, slope-
deflection method and the force method.

Three-Moments-Equation Method
The three-moment equation method gives us the relation between the moments
between any three points in a beam and their relative vertical distances or deviations.
The three moments equation is given as follows:
𝑀1 𝐿1 𝐿1 𝐿2 𝑀3 𝐿3 6𝐴1 𝑎̅1 6𝐴2 𝑏̅2
+ 2𝑀2 ( + )+ =− −
𝐸1 𝐼1 𝐸1 𝐼1 𝐸2 𝐼2 𝐸3 𝐼3 𝐸1 𝐼1 𝐿1 𝐸2 𝐼2 𝐿2

Which reduces when E is constant to:


𝑀1 𝐿1 𝐿1 𝐿2 𝑀3 𝐿3 6𝐴1 𝑎̅1 6𝐴2 𝑏̅2
+ 2𝑀2 ( + ) + =− −
𝐼1 𝐼1 𝐼2 𝐼3 𝐼1 𝐿1 𝐼2 𝐿2

And reduces when both E and I are constant to:


6𝐴1 𝑎̅1 6𝐴2 𝑏̅2
𝑀1 𝐿1 + 2𝑀2 (𝐿1 + 𝐿2 ) + 𝑀3 𝐿3 = − −
𝐿1 𝐿2
𝑤ℎ𝑒𝑟𝑒 𝑀1 , 𝑀2 𝑎𝑛𝑑 𝑀3 𝑎𝑟𝑒 𝑠𝑢𝑝𝑝𝑜𝑟𝑡𝑠 𝑚𝑜𝑚𝑒𝑛𝑡𝑠,

Page 67 JARAR Vol. 2 (2) 2023 E-ISSN 3027-1347 P-ISSN 3027-043X


Journal of African Resilience & Advancement Research JARAR2023 [E-ISSN 3027-1347 P-ISSN 3027-043X] Vol. 2

𝐿1 𝑎𝑛𝑑 𝐿2 𝑎𝑟𝑒 𝑠𝑝𝑎𝑛𝑠


𝐸1 𝑎𝑛𝑑 𝐸2 𝑎𝑟𝑒 𝑒𝑙𝑎𝑠𝑡𝑖𝑐 𝑚𝑜𝑑𝑢𝑙𝑢𝑠
𝐼1 𝑎𝑛𝑑 𝐼2 𝑎𝑟𝑒 𝑚𝑜𝑚𝑒𝑛𝑡 𝑜𝑓 𝑖𝑛𝑖𝑡𝑖𝑎
𝐴1 𝑎𝑛𝑑 𝐴2 𝑎𝑟𝑒 𝑎𝑟𝑒𝑎𝑠 𝑜𝑓 𝑏𝑒𝑛𝑑𝑖𝑛𝑔 𝑚𝑜𝑚𝑒𝑛𝑡 𝑑𝑖𝑎𝑔𝑟𝑎𝑚𝑠
𝑎̅1 𝑎𝑛𝑑 𝑏̅2 𝑎𝑟𝑒 𝑐𝑜𝑛𝑡𝑟𝑜𝑖𝑑𝑠 𝑜𝑓 𝑡ℎ𝑒 𝑏𝑒𝑛𝑑𝑖𝑛𝑔 𝑚𝑜𝑚𝑒𝑛𝑡 𝑑𝑖𝑎𝑔𝑟𝑎𝑚𝑠.
(Roark, 2002)

Slope-Deflection Method
The slople-deflection method relates the unknown slopes and deflections to the applied
load on a structure, treating each span separately. The moments (MAB and MBA) at the
ends of a span A-B are related with slopes at their ends and the relative supports
displacement with the given formulae.
2𝐸𝐼
𝑀𝐴𝐵 = (2𝜃𝐴 + 𝜃𝐵 − 3𝜑) + 𝐹𝐸𝑀𝐴𝐵
𝐿
2𝐸𝐼
𝑀𝐵𝐴 = (𝜃𝐴 + 2𝜃𝐵 − 3𝜑) + 𝐹𝐸𝑀𝐵𝐴
𝐿
𝑤ℎ𝑒𝑟𝑒 𝐸𝐼 𝑖𝑠 𝑓𝑙𝑒𝑥𝑢𝑟𝑎𝑙 𝑟𝑖𝑔𝑖𝑑𝑖𝑡𝑦 𝑜𝑓 𝑚𝑒𝑚𝑏𝑒𝑟, 𝜃𝐴 𝑎𝑛𝑑 𝜃𝐵

𝑠𝑙𝑜𝑝𝑒 𝑒𝑛𝑑𝑠, 𝐹𝐸𝑀𝐴𝐵 𝑎𝑛𝑑 𝐹𝐸𝑀𝐵𝐴 𝑓𝑖𝑥𝑒𝑑 𝑒𝑛𝑑 𝑚𝑜𝑚𝑒𝑛𝑡𝑠 𝑎𝑡 𝑒𝑛𝑑𝑠, 𝜑 = ,
𝐿
𝑤ℎ𝑒𝑟𝑒 ∆ 𝑖𝑠 𝑟𝑒𝑙𝑎𝑡𝑖𝑣𝑒 𝑠𝑢𝑝𝑝𝑜𝑟𝑡𝑠 𝑑𝑖𝑠𝑝𝑙𝑎𝑐𝑒𝑚𝑒𝑛𝑡 𝑎𝑛𝑑 𝐿 𝑠𝑝𝑎𝑛 𝑜𝑓 𝑡ℎ𝑒 𝑚𝑒𝑚𝑏𝑒𝑟.

The slope-deflection equations can be obtained by using the principle of superposition


by considering separately the moments developed at each support due to each of the
ends displacements and then the loads. (Kassimali, 2012 & Hibbeler, 2015)

Force Method
This method involves releasing the redundants from an indeterminate structure and
ensuring conpatibity of the released structure with redundants acting separately as the
only loads on the structure. This will result in equations with the redundants as
unknowns. When the equations are solved and the rendundants determined, the
structure can be fully analysed using equilibrium equations. (Ghali et al., 2017,R.
Hibbeler, 2017, Kassimali, 2012 and Connor & Faraji, 2016)

Applications of Python in Solving Equations


A case of continous beam with many redundants is considered. In order to assess the
efficiency, effectiveness and reliability of the solvers in Python, several methods were
used to analyse the beam and the results obtained from the different methods were
compared and there accuracy compared with predetermined values. Three methods

Page 68 JARAR Vol. 2 (2) 2023 E-ISSN 3027-1347 P-ISSN 3027-043X


Journal of African Resilience & Advancement Research JARAR2023 [E-ISSN 3027-1347 P-ISSN 3027-043X] Vol. 2

were used, which are: three-moments-equation method, slope-deflection method and


the force method.

The Problem Case


42kN 30kN 48kN
15kN/m

A B C D E F

4m 2 4m 3m 3m 2 3 5m
m m m
Figure 1
Python Equation Solver
The python program to solve simultaneous equations using both NumPy and SciPy is
hereby presented as follows:
The following commands are to be run from a python environment, after entering the
values for a and b (Note: # is for comment and description. It is a nonexecutable
statement):

import numpy as np
import scipy as sp
# Array variable declaration representing the coefficients of equations
a = np.array([]) #values are entered row by row when they become available
# Array variable declaration for the values after the equal sign
b = np.array([]) #Values after the equal signs are entered, separated by commas
# Variable to store solution values after solving
# Using NumPy Solver
x = np.linalg.solve(a,b) # Solution values are stored in the variable x
# Prompt to display, Solution using NumPy Solver
Print(‘Solution using NumPy Solver’)
# This displays the solution
print(x)
# Using SciPy Solver
x = sp.linalg.solve(a,b) # Solution values are stored in the variable x
# Prompt to display, Solution using SciPy Solver
Print(‘Solution using SciPy Solver’)
# This displays the solution
print(x)

Page 69 JARAR Vol. 2 (2) 2023 E-ISSN 3027-1347 P-ISSN 3027-043X


Journal of African Resilience & Advancement Research JARAR2023 [E-ISSN 3027-1347 P-ISSN 3027-043X] Vol. 2

Solution Using Three-Moments-Equation Method


15 × 53 15 × 63 42(62 − 42 )
4 × 𝑀𝐴 + 2𝑀𝐵 (4 + 6) + 6 × 𝑀𝐶 = − − −
4 4 6
10𝑀𝐵 + 3𝑀𝐶 = −805 − − − − − − − − − − − − − −(1)
6 × 𝑀𝐵 + 2𝑀𝐶 (6 + 6) + 6 × 𝑀𝐷
15 × 63 42(62 − 22 ) 15 × 63 30(62 − 32 )
=− − − −
4 6 4 6
6𝑀𝐵 + 24𝑀𝐶 + 6𝑀𝐷 = −2473 − − − − − − − − − − − − − −(2)
6 × 𝑀𝐶 + 2𝑀𝐷 (6 + 5) + 5 × 𝑀𝐸
15 × 63 30(62 − 32 ) 15 × 53 48(62 − 32 )
=− − − −
4 6 4 6
−42891
6𝑀𝐶 + 22𝑀𝐷 + 5𝑀𝐸 = − − − − − − − − − − − − − −(3)
20
15 × 53 48(52 − 22 ) 15 × 53
5 × 𝑀𝐷 + 2𝑀𝐸 (5 + 5) + 5 × 𝑀𝐹 = − − −
4 5 4
−13407
5𝑀𝐷 + 20𝑀𝐸 = − − − − − − − − − − − − − −(4)
10

The equations are solved using NumPy and SciPy linear algebra as earlier outlined in
the python program.
The procedure for solving the equations is as follows:
Firstly, form a matrix from the equations.
−805
10 3 0 0 𝑀 𝐵 −2473
6 24 6 0 𝑀𝐶 42891
[ ]{ }= −
0 6 22 5 𝑀𝐷 20
0 0 5 20 𝑀𝐸 13407
{− 10 }
To run the python program, “a” and “b” in the program are defined as follows:
a = np.array([[10, 3, 0, 0], [6, 24, 6, 0], [0, 6, 22, 5], [0, 0, 5, 20])
b = np.array([-805, -2373, -42891/20, -13407/10])
Running the file after the entry will give the following output:
Solution using NumPy Solver
[-58.99788061 -71.67373131 -66.47386083 -50.41653480]
Solution using SciPy Solver
[-58.99788061 -71.67373131 -66.47386083 -50.41653480]
Both NumPy and SciPy gave identical results.
MB = -58.99788061 kNm
MC = -71.67373131 kNm
MD = -66.47386083 kNm
Page 70 JARAR Vol. 2 (2) 2023 E-ISSN 3027-1347 P-ISSN 3027-043X
Journal of African Resilience & Advancement Research JARAR2023 [E-ISSN 3027-1347 P-ISSN 3027-043X] Vol. 2

ME = -50.41653480 kNm
Solution Using Slope-Deflection Equation Method
Fixed End Moments
247
𝐹𝐸𝑀𝑀𝐴𝐵 = −20𝑘𝑁𝑚 , 𝐹𝐸𝑀𝑀𝐵𝐴 = 20𝑘𝑁𝑚, 𝐹𝐸𝑀𝑀𝐵𝐶 = − 𝑘𝑁𝑚, 𝐹𝐸𝑀𝑀𝐶𝐵 =
3
191 135 135
𝑘𝑁𝑚, 𝐹𝐸𝑀𝑀𝐶𝐷 = − 𝑘𝑁𝑚, 𝐹𝐸𝑀𝑀𝐷𝐶 = 𝑘𝑁𝑚, 𝐹𝐸𝑀𝑀𝐷𝐸 =
3 2 2
6581 5429 125 125
− 𝑘𝑁𝑚, 𝐹𝐸𝑀𝑀𝐸𝐷 = 𝑘𝑁𝑚, 𝐸𝑀𝑀𝐸𝐹 = − 𝑘𝑁𝑚, 𝐹𝐸𝑀𝑀𝐹𝐸 = 𝑘𝑁𝑚
100 100 4 4
Slope-Deflection Equations
𝐸𝐼𝜃𝐵
𝑀𝐴𝐵 = 𝐸𝐼𝜃𝐴 + − 20 − − − − − − − − − −(1)
2
𝐸𝐼𝜃𝐴
𝑀𝐵𝐴 = + 𝐸𝐼𝜃𝐵 + 20 − − − − − − − − − −(2)
2
2𝐸𝐼𝜃𝐵 𝐸𝐼𝜃𝐶 247
𝑀𝐵𝐶 = + − − − − − − − − − − −(3)
3 3 3
𝐸𝐼𝜃𝐵 2𝐸𝐼𝜃𝐶 191
𝑀𝐶𝐵 = + + − − − − − − − − − −(4)
3 3 3
2𝐸𝐼𝜃𝐶 𝐸𝐼𝜃𝐷 135
𝑀𝐶𝐷 = + − − − − − − − − − − −(5)
3 3 2
𝐸𝐼𝜃𝐶 2𝐸𝐼𝜃𝐷 135
𝑀𝐷𝐶 = + + − − − − − − − − − −(6)
3 3 2
4𝐸𝐼𝜃𝐷 2𝐸𝐼𝜃𝐸 6581
𝑀𝐷𝐸 = + − −−−−−−−−
5 5 100
− −(7)
2𝐸𝐼𝜃𝐷 4𝐸𝐼𝜃𝐸 5429
𝑀𝐸𝐷 = + + −−−−−−−−
5 5 100
− −(8)
4𝐸𝐼𝜃𝐸 2𝐸𝐼𝜃𝐹 125
𝑀𝐸𝐹 = + − − − − − − − − − − −(9)
5 5 4
2𝐸𝐼𝜃𝐸 4𝐸𝐼𝜃𝐹 125
𝑀𝐹𝐸 = + + − − − − − − − − − −(10)
5 5 4
𝑀𝐴𝐵 = 𝑀𝐸𝐷 = 0
𝑓𝑟𝑜𝑚 𝑒𝑞𝑢𝑎𝑡𝑖𝑜𝑛 (1) 𝑤𝑒 ℎ𝑎𝑣𝑒:
𝐸𝐼𝜃𝐵
𝐸𝐼𝜃𝐴 + = 20 − − − − − − − − − (11)
2
𝑀𝐵𝐴 + 𝑀𝐵𝐶 = 0
𝐸𝐼𝜃𝐴 5𝐸𝐼𝜃𝐵 𝐸𝐼𝜃𝐶 187
+ + = − − − − − − − −(12)
2 3 3 3
𝑀𝐶𝐵 + 𝑀𝐶𝐷 = 0
𝐸𝐼𝜃𝐵 4𝐸𝐼𝜃𝐶 𝐸𝐼𝜃𝐷 23
+ + = − − − − − − − − − −(13)
3 3 3 6

Page 71 JARAR Vol. 2 (2) 2023 E-ISSN 3027-1347 P-ISSN 3027-043X


Journal of African Resilience & Advancement Research JARAR2023 [E-ISSN 3027-1347 P-ISSN 3027-043X] Vol. 2

𝑀𝐷𝐶 + 𝑀𝐷𝐸 = 0
𝐸𝐼𝜃𝐶 22𝐸𝐼𝜃𝐷 2𝐸𝐼𝜃𝐸
+ +
3 15 5
169
=− − − − − − − − − − (14)
100
𝑀𝐸𝐷 + 𝑀𝐸𝐹 = 0
2𝐸𝐼𝜃𝐷 8𝐸𝐼𝜃𝐸 2𝐸𝐼𝜃𝐹
+ +
5 5 5
576
=− − − − − − − − − − (15)
25
𝑓𝑟𝑜𝑚 𝑒𝑞𝑢𝑎𝑡𝑖𝑜𝑛 (10) 𝑤𝑒 ℎ𝑎𝑣𝑒:
2𝐸𝐼𝜃𝐸 4𝐸𝐼𝜃𝐹 125
+ =− − − − − − − − − − (16)
5 5 4
Representing equations (11) to (16) in matrix form we have:
1
1 0 0 0 0 20
2 187
1 5 1 𝐸𝐼𝜃𝐴
0 0 0 3
2 3 3
1 41 𝐸𝐼𝜃𝐵 23
0 3 3 3 0 0 𝐸𝐼𝜃𝐶 6
1 22 2 = − 169 `
0 0 3 15 5 0 𝐸𝐼𝜃𝐷 100
𝐸𝐼𝜃𝐸 576
2 8
0 0 0 5 5 5 {𝐸𝐼𝜃𝐹 }
2 − 25
125
0 0 0 0
2 4
{ − 4 }
[ 5 5]
When the values for “a” and “b” and entered and the program executed, this output is
obtained:
Solution using NumPy Solver
[ 0.66807959 38.66384081 -7.32132344 2.12145296 -5.90255799
-36.11122101]
Solution using SciPy Solver
[ 0.66807959 38.66384081 -7.32132344 2.12145296 -5.90255799
-36.11122101]
𝑇ℎ𝑒 𝑣𝑎𝑙𝑢𝑒𝑠 𝑜𝑏𝑡𝑎𝑖𝑛𝑒𝑑 𝑎𝑟𝑒 𝑓𝑜𝑟 𝐸𝐼𝜃𝐴 , 𝐸𝐼𝜃𝐵 , 𝐸𝐼𝜃𝐶 , 𝐸𝐼𝜃𝐷 ,
𝐸𝐼𝜃𝐸 𝑎𝑛𝑑 𝐸𝐼𝜃𝐹
Substituting the values into the slope-deflection equations we have:
𝑀𝐴𝐵 = 0 𝑘𝑁𝑚, 𝑀𝐵𝐴 = 58.99788060755917 kNm,
𝑀𝐵𝐶 = −58.99788060755916 kNm
𝑀𝐶𝐵 = 71.67373130813611 kNm,
𝑀𝐶𝐷 = −71.67373130813611 kNm,
𝑀𝐷𝐶 = 66.47386082656305 kNm

Page 72 JARAR Vol. 2 (2) 2023 E-ISSN 3027-1347 P-ISSN 3027-043X


Journal of African Resilience & Advancement Research JARAR2023 [E-ISSN 3027-1347 P-ISSN 3027-043X] Vol. 2

𝑀𝐷𝐸 = −66.47386082656305 kNm , 𝑀𝐸𝐷 = 50.41653479335923 kNm


𝑀𝐸𝐹 = −50.41653479335923 kNm,
𝑀𝐹𝐸 = 0 𝑘𝑁𝑚

Solution Using Force Method


In this analysis, RB, RC, RD and RE are considered as the redundant loads.

The Released Structure


42kN 30kN 48kN
15kN/m

A F

Figure 2 26m

The Redundant Loads


A F
𝑅𝐵 𝑅𝐶 𝑅𝐷 𝑅𝐸
4m 2m 4m 3m 3m 2m 3m 5m
Figure 3
Deflections from the released structure (at points: B, C, D and E)
759178 116303 116519 7415285
𝑦𝐵1 = , 𝑦𝐶1 = , 𝑦𝐷1 = , 𝑦𝐸1 =
13EI EI EI 104EI

Deflections from the redundant loads (at points: B, C, D and E)


−3872𝑅𝐵 6464𝑅𝐶 5600𝑅𝐷 3175𝑅𝐸
𝑦𝐵2 = − − −
39EI 39EI 39EI 39EI
−6464𝑅𝐵 12800𝑅𝐶 11900𝑅𝐷 137755𝑅𝐸
𝑦𝐶2 = − − −
39EI 39EI 39EI 78EI
−5600𝑅𝐵 11900𝑅𝐶 12800𝑅𝐷 7900𝑅𝐸
𝑦𝐷2 = − − −
39EI 39EI 39EI 39EI
−3175𝑅𝐵 13775𝑅𝐶 7900𝑅𝐷 3675𝑅𝐸
𝑦𝐸2 = − − −
39EI 78EI 39EI 26EI

Compatibility Equations
3872𝑅𝐵 6464𝑅𝐶 5600𝑅𝐷 3175𝑅𝐸 759178
+ + + = − − − − − − − (1)
39 39 39 39 13

Page 73 JARAR Vol. 2 (2) 2023 E-ISSN 3027-1347 P-ISSN 3027-043X


Journal of African Resilience & Advancement Research JARAR2023 [E-ISSN 3027-1347 P-ISSN 3027-043X] Vol. 2

6464𝑅𝐵 12800𝑅𝐶 11900𝑅𝐷 137755𝑅𝐸


+ + + = 116303 − − − − − −(2)
39 39 39 78
5600𝑅𝐵 11900𝑅𝐶 12800𝑅𝐷 7900𝑅𝐸
+ + + = 116519 − − − − − − − (3)
39 39 39 39
3175𝑅𝐵 13775𝑅𝐶 7900𝑅𝐷 3675𝑅𝐸 7415285
+ + + = − − − − − − − (4)
39 78 39 26 104
The “a” and “b” matrices are formed for the program.
3872 6464 5600 5600
39 39 39 39 759178
6464 12800 11900 137755 𝑅𝐵 13
39 39 39 78 𝑅𝐶 116303
{ }=
5600 11900 12800 7900 𝑅𝐷 116519
39 39 39 39 𝑅𝐸 7415285
3175 13775 7900 3675 { 104 }
[ 39 78 39 26 ]

𝑅𝐵 = 115.636828368460 𝑘𝑁, 𝑅𝐶 = 121.979286863692𝑘𝑁,


𝑅𝐷 = 128.644820126379 𝑘𝑁, 𝑅𝐸 = 101.071841752031 𝑘𝑁
Solving using equilibrium equations the following results are obtained.
𝑅𝐴 = 15.2505298481102 𝑘𝑁, 𝑀𝐵 = −58.9978806075592 𝑘𝑁𝑚,
𝑀𝐶 = −71.6737313081361 𝑘𝑁𝑚
𝑀𝐷 = −66.4738608265629 𝑘𝑁𝑚, 𝑀𝐸 =
−50.4165347933595 𝑘𝑁𝑚, 𝑅𝐹 = 27.4166930413282 𝑘𝑁

Discussion of Results
Table 1: Results
METHO Actual Solution Python Solution
D NumPy SciPy
Three- 167023 𝑀𝐵 𝑀𝐵
𝑀𝐵 = 𝑘𝑁𝑚
Momen 2831 = −58.9978806075592= 𝑘𝑁𝑚
−58.9978806075592 𝑘𝑁𝑚
ts = −58.9978806075592 𝑘𝑁𝑚 𝑀𝐶 𝑀𝐶
608725
Equatio 𝑀𝐶 = 𝑘𝑁𝑚 = −71.6737313081361=𝑘𝑁𝑚 −71.6737313081361 𝑘𝑁𝑚
n 8493 𝑀𝐷 𝑀𝐷
= −71.6737313081361=𝑘𝑁𝑚−66.4738608265629=𝑘𝑁𝑚
−66.4738608265629 𝑘𝑁𝑚
376375
𝑀𝐷 = 𝑘𝑁𝑚 𝑀𝐸 𝑀𝐸
5662
= −50.4165347933595= 𝑘𝑁𝑚
−50.4165347933595 𝑘𝑁𝑚
= −66.4738608265629 𝑘𝑁𝑚
Slope- 14272921 𝑀𝐵 𝑀𝐵
Deflect 𝑀𝐸 = 283100 𝑘𝑁𝑚 = −58.9978806075592= 𝑘𝑁𝑚
−58.9978806075592 𝑘𝑁𝑚
ion

Page 74 JARAR Vol. 2 (2) 2023 E-ISSN 3027-1347 P-ISSN 3027-043X


Journal of African Resilience & Advancement Research JARAR2023 [E-ISSN 3027-1347 P-ISSN 3027-043X] Vol. 2

Equatio = −50.4165347933595 𝑘𝑁𝑚 𝑀𝐶 𝑀𝐶


n = −71.6737313081361=𝑘𝑁𝑚
−71.6737313081361 𝑘𝑁𝑚
𝑀𝐷 𝑀𝐷
= −66.4738608265629=𝑘𝑁𝑚
−66.4738608265629 𝑘𝑁𝑚
𝑀𝐸 𝑀𝐸
= −50.4165347933595=𝑘𝑁𝑚
−50.4165347933595 𝑘𝑁𝑚
Force 𝑀𝐵 𝑀𝐵
Method = −58.9978806075592=𝑘𝑁𝑚
−58.9978806075592 𝑘𝑁𝑚
𝑀𝐶 𝑀
= −71.6737313081361=𝑘𝑁𝑚
−71.6737313081361 𝑘𝑁𝑚
𝑀𝐷 𝑀𝐷
= −66.4738608265629=𝑘𝑁𝑚
−66.4738608265629 𝑘𝑁𝑚
𝑀𝐸 𝑀𝐸
= −50.4165347933595=𝑘𝑁𝑚
−50.4165347933595 𝑘𝑁𝑚

The results as compared showed that the solutions from python are accurate. It can
also be seen that both NumPy and SciPy packages produced identical results and in
the same format.

Conclusion
Python programming is simple and easy to use. The packages NumPy and SciPy
provides efficient and effective platform for solving equations, which under normal
circumstances, will require costly specialized software packages. The solutions from
using NumPy and SciPy are found to be accurate. Not only were the solutions accurate,
but the procedure is simple and easy. It is recommended for further research be carried
out to explore the power of NumPy and SciPy in handling problems associated with
building and engineering projects.

Recommendations
The following are offered as recommendations:
i. Lecturers, Teachers, and Instructors in institutions of higher education to
acquire and update their skills with respect to Python programming to translate
same to students.
ii. Professional bodies of building and engineering to organize training
workshops for their members to Python programming skills.
iii. Professionals in building and engineering professions should consider the use
of Python as a solution tool.

Page 75 JARAR Vol. 2 (2) 2023 E-ISSN 3027-1347 P-ISSN 3027-043X


Journal of African Resilience & Advancement Research JARAR2023 [E-ISSN 3027-1347 P-ISSN 3027-043X] Vol. 2

References
Aslam Kassimali. (2012). Structural Analysis Fourth Edition. In Southern Illinois University—Carbondale (Vol.
53, Issue 9).
Blanco-silva, F. J. (2015). Mastering SciPy. In Packt Publishing.
Boulle, A., & Kieffer, J. (2019). High-performance Python for crystallographic computing. Journal of Applied
Crystallography. https://doi.org/10.1107/S1600576719008471
Bressert, E. (2013). SciPy and NumPy. O’Reilly Media, Inc.
Connor, J. J., & Faraji, S. (2016). Fundamentals of structural engineering: Second edition. In Fundamentals of
Structural Engineering: Second Edition. https://doi.org/10.1007/978-3-319-24331-3
DataCamp. (2015). SciPy - Linear Algebra. DataCamp.
Ghali, A., Neville, A. M., & Brown, T. G. (2017). Structural Analysis: A unified classical and matrix approach,
Sixth edition. In Structural Analysis: A Unified Classical and Matrix Approach, Sixth Edition.
https://doi.org/10.1201/9781315273006
Harris, C. R., Millman, K. J., van der Walt, S. J., Gommers, R., Virtanen, P., Cournapeau, D., Wieser, E., Taylor,
J., Berg, S., Smith, N. J., Kern, R., Picus, M., Hoyer, S., van Kerkwijk, M. H., Brett, M., Haldane, A., del Río,
J. F., Wiebe, M., Peterson, P., … Oliphant, T. E. (2020). Array programming with NumPy. In Nature (Vol.
585, Issue 7825). https://doi.org/10.1038/s41586-020-2649-2
Hibbeler, R. (2017). Structural Analysis Tenth Edition. Pearson.
Hibbeler, R. C. (2015). Structural Analysis 9th Edition. In A Companion to Cognitive Science.
Hill, C. (2016). SciPy. In Learning Scientific Programming with Python.
https://doi.org/10.1017/cbo9781139871754.008
Idris, I. (2012). NumPy Cookbook. In NumPy Cookbook.
J. Goldbaum, N., A. ZuHone, J., J. Turk, M., Kowalik, K., & L. Rosen, A. (2018). unyt: Handle, manipulate, and
convert data with units in Python. Journal of Open Source Software, 3(28). https://doi.org/10.21105/joss.00809
Kaufmann, J., & Held, K. (2023). ana_cont: Python package for analytic continuation. Computer Physics
Communications, 282. https://doi.org/10.1016/j.cpc.2022.108519
Kuhlman, D. (2013). A Python Book: Beginning Python, Advanced Python, and Python Exercises. A Python Book.
Lemenkova, P. (2019). PROCESSING OCEANOGRAPHIC DATA BY PYTHON LIBRARIES NUMPY, SCIPY
AND PANDAS. Aquatic Research. https://doi.org/10.3153/ar19009
Lynch, S. (2023). Anaconda, Spyder and the Libraries NumPy, Matplotlib and SymPy. In Python for Scientific
Computing and Artificial Intelligence. https://doi.org/10.1201/9781003285816-2
Martins, L. F., Ramos, R. O., & Ayydevara, V. K. (2017). Scipy Recipes. In Packt Publishing Ltd.
Mehare, H. Bin, Anilkumar, J. P., & Usmani, N. A. (2023). The Python Programming Language. In A Guide to
Applied Machine Learning for Biologists. https://doi.org/10.1007/978-3-031-22206-1_2
Pawlik, A., Segal, J., Sharp, H., & Petre, M. (2015). Crowdsourcing scientific software documentation: A case
study of the NumPy documentation project. Computing in Science and Engineering, 17(1).
https://doi.org/10.1109/MCSE.2014.93
Quraishi, M. A., & Dhapekar, M. N. K. (2021). Applicability of Python in Civil Engineering: Review. International
Research Journal of Engineering and Technology, 8(1).
Roark, R. J. (Raymond J. (2002). Roark’s formulas for stress and strain Warren C. Young, Richard G. Budynas. In
Roark’s formulas for stress and strain.
Santos, T. T. (2015). SciPy and OpenCV as an interactive computing environment for computer vision. Revista de
Informática Teórica e Aplicada, 22(1). https://doi.org/10.22456/2175-2745.49491
Stewart, J. M., & Mommert, M. (2023). About Python. In Python for Scientists.
https://doi.org/10.1017/9781009029728.003
Virtanen, P., Gommers, R., Oliphant, T. E., Haberland, M., Reddy, T., Cournapeau, D., Burovski, E., Peterson, P.,
Weckesser, W., Bright, J., van der Walt, S. J., Brett, M., Wilson, J., Millman, K. J., Mayorov, N., Nelson, A.
R. J., Jones, E., Kern, R., Larson, E., … Vázquez-Baeza, Y. (2020). SciPy 1.0: fundamental algorithms for
scientific computing in Python. Nature Methods, 17(3). https://doi.org/10.1038/s41592-019-0686-2
Waheed Kadhim, R., jaffar Raheem, M., Makki Mohialden, Y., & Mahmood Hussien, N. (2022). A Review of the
Implementation of NumPy and SciPy Packages in Science and Math. Turkish Journal of Computer and
Mathematics Education (TURCOMAT), 13(03).
Wang, J., & Wang, A. (2023). Python Tutorial. https://doi.org/10.1007/978-3-031-17646-3_2
Zemkoho, A. (2023). A Basic Time Series Forecasting Course with Python. Operations Research Forum, 4(1).
https://doi.org/10.1007/s43069-022-00179-z

Page 76 JARAR Vol. 2 (2) 2023 E-ISSN 3027-1347 P-ISSN 3027-043X

You might also like