More iterative solvers

Following the recent post on using Brent’s Method solvers on an array (Iterative solvers and arrays), here is another example with an engineering related problem.  The example is included in the xlScipy3 spreadsheet, which can be downloaded from:

The depth of the Neutral Axis of a reinforced concrete section, under specified bending moment and axial load, can be found with the cubic equation below (click any image for full size view):

Derivation of the constants A to G is shown below.  As before, the equation may either be solved using a Python function (FindDNA), or by evaluating a lambda function entered as text on the spreadsheet.  In the former case the constants are passed to the function as an array; in the latter the constants are converted to their numerical value in the text on the spreadsheet, as shown below.  Note that this is done automatically using the Eval function:

Results calling Func Type 1 (FindDNA) are shown below:

Using Func Type 2 (evaluating the text function on the spreadsheet) returns the same results.  Note that the xl_BrentA arguments must be edited to remove the final argument (the array of constant values), otherwise the function will return an error.  To edit an array function:

  • Select the top-left cell of the array (Y79), and press F2 (Edit).
  • Make the required changes.
  • Press Ctrl-Shift-Enter.
This entry was posted in Arrays, Beam Bending, Concrete, Excel, Link to Python, Maths, Newton, NumPy and SciPy, UDFs, VBA, xlwings and tagged , , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.