Forum Replies Created
-
AuthorPosts
-
Hi Josh,
Good question!
The key words here are install and import, which are two different things. When we say pip install xxxx, we are asking pip to find and install the package onto our computer. However, this doesn’t make it available to a piece of Python code that we write. Before we use a package in our code, we have to tell Python in advance that it is going to need to get that package ready. This is called importing the package, and it makes everything in the package available to our code.
We need to import every time we run a piece of code, but we only need to install once onto any computer that we use. In the example you gave, Google Colab will already have the matplotlib module installed (that’s just how it’s set up). If you were running this code on your local machine and you hadn’t yet installed matplolib you would get an error.
Quick point about !pip install xxxx. This is the same as typing pip install xxxx into the command line of your computer, it just does it straight from our notebook, saving you a bit of time. It also works in Google Colab to install packages which aren’t already installed by default. However, it does mean you might be asking pip to install a module that you’ve installed before. If this is the case, it will tell you “requirement already satisfied” (and you will be wasting precious seconds!)
Hope this helps,
Sam
Hi Sandip,
Really love your example of a wind calc f0r this module. It’s a calculation that you really need to explain each step clearly because it can affect the design so significantly.
I think the reason you cannot replicate the results presented in the IS875 code is because you are redefining P_N each time. This isn’t the intention of the code. As you vary N (the mean probably design life), you actually want to keep the chance of exceeding your design wind speed constant, so P_N doesn’t change as you vary N. Selection of P_N will be based on various factors, but the code recommends 0.63. This is a similar approach to other international standards.
If you set P_N = 0.63 (i.e. independent of N) you will be able to replicate the results of IS875 Table 1 (see my version of this calculation attached).
Hope this helps!
– Sam

Just to add to this discussion, I think the key words we are looking at here is “monotonic” (which is essentially the mathematical verstion of “sorted”). As you point out, Thom, binary search on a non-monotonic range isn’t guaranteed to get the answer. You could easily contrive a much more complicated function (one that went up and down at a high frequency for example), where binary search would be impossible. However, on our function, as Timo points out, we actually have subranges of our function that are monotonic (d/b 1.0 >> 1.5 and d/b 1.5 >> 2.0). So, one solution might be to implement binary search on these subranges.
Luckily for structural engineers, most of the functions we work with are monotonic (indeed, they are often linear). The notable exceptions are wind behaviour, as we see here, and some non-linear FE models (the true stress-strain curve for steel, for example). I can’t think of others right now, but I’m sure there are some!

<div style=”position: absolute; left: 256px; top: 31px;”>
<div class=”gtx-trans-icon”></div>
</div> -
AuthorPosts