Scipy-statistics with distributions

The Scipy statistics functions last presented here have now been updated with the addition of links to the numerous distribution functions.

The py_Stats spreadsheet, with associated Python code in PythonStatsFuncs3.py and pyScipy3.py, and also minor updates to the pyNumpy.py code, are included in the download file:

py_SciPy.zip

Details of the required pyxll package (including download, free trial, and full documentation) can be found at: pyxll

For those installing a new copy of pyxll, a 10% discount on the first year’s fees is available using the coupon code “NEWTONEXCELBACH10”.

The Scipy distribution functions are divided into Continuous, Multivariate, and Discrete. There are 114 continuous functions, each with a large number of different methods. All of these functions can be called from Excel with the py_rv_continuous function, specifying the required distribution and associated method, followed by required arguments, then any optional arguments, listed in dictionary format. There are also specific functions calling the Normdist and Norminvgauss functions, as shown below:

The spreadsheet lists all the available methods of the Normdist function, with required and optional arguments. Help on the methods of the other distributions can be found at the linked on-line help.

For the multivariate functions there is more variation in the function arguments, so each function has an associated Excel function, with an example on the spreadsheet:

All the functions are listed on the spreadsheet with a short description and a link to the associated on-line help:

The on-line help may also be accessed when entering the function in the spreadsheet, using the “help on this function” link at the bottom-left of the function dialog:

The Multivariate and Discrete functions are also listed on the spreadsheet, with a link to the on-line help for each:

Note that this is a work in progress, and that Excel functions have not yet been created for the Discrete list.

Posted in Arrays, Excel, Link to Python, Maths, Newton, NumPy and SciPy, Python Pandas, PyXLL, UDFs | Tagged , , , , , , , , , | Leave a comment

Dealing with annoying Excel defaults

Mynda Tracey’s MyonlineTrainingHub has a recent post on how to change 15 Excel default settings at:

Excel Settings You Need to Change

Raise your hand if Excel’s default settings have ever driven you just a little bit crazy.

Maybe your invoice numbers lose their leading zeros…
Maybe you’re tired of Excel shoving GETPIVOTDATA into your formulas…
Maybe the new Copilot icon is following your every move!

You’re not alone. Excel’s defaults are made for average users. But you? You’re here to level up. So let’s fix those annoyances and make Excel work for you.

Here are 15 simple but game-changing Excel settings you’ll wish you’d changed sooner

The link includes links to a YouTube video and a text version, plus links to a cheat-sheet and other resources from the site. Warning: the site has plenty of ads, and links to external downloads of commercial products, so be careful where you click!

Posted in Excel | Tagged , , | Leave a comment

The Ultimate Python Guide for VBA Developers

I recently discovered “The Ultimate Python Guide for VBA Developers” which is a free book available from the pyxll site at https://www.pyxll.com/learn-python.html.

The pyxll site says:

This book has been written specifically for VBA and Excel users like you. Fast track your Python journey and take your productivity to a whole new level.

Here are just some of the topics you will learn about in this book

Getting started with Python
Key differences between VBA and Python
Choosing a Python IDE
All about functions, modules and packages
Python datatypes and collections
Scientific computing with NumPy, Pandas and SciPy
IPython and Jupyter Notebooks
Excel integration and writing Excel add-ins

I found it to be an excellent introduction to (and reminder of) the basics of getting started with Python.

The link above also has many other resources, including:

The VBA to Python Cheat Sheet
Use our free Python to VBA Cheat Sheet to accelerate learning Python.
Keep it as a handy reference and you’ll be proficient with Python in no time!

which is a great reminder of the Python basics

Posted in Computing - general, Excel, Link to Python, Python Pandas, PyXLL, UDFs, VBA | Tagged , , | Leave a comment

… and finally py_xlCBA 0.6 with trapezoidal loads

The latest version of the Python continuous beam analysis program pyCBA is 0.7, allowing for specification of trapezoidal distributed loads, and this is now available with pip. I have updated the py-xlCBA spreadsheet and associated code to use the latest version, and the revised files can be downloaded from:

py_xlCBA.zip

As before the spreadsheet requires Python to be installed, as well as pyCBA (version 0.7 or later), and pyxll to handle the Excel/Python interface. See Python and pyxll for more details of pyxll, and a discount code for those opening a new pyxll account.

The distributed load input now has four columns, allowing for the load/m to be defined at the start and end of the load:

If the fourth column is not selected or left blank the load will be treated as rectangular. To define a triangular load a zero must be entered in the start or end column.

All analysis options are now available with the py_CBAcache function, which returns a single cell cache object, from which results may be extracted with the py_CBARes or py_CBAReact functions:

The Matplotlib graphics generated by pyCBA may be displayed in Excel using the py_CBAcache function (as shown above), or using py_CBA.

The detailed check against Strand7 results has been updated with trapezoidal loads:

The results of the 15 different span arrangements, each with 6 different support conditions can be seen in the file Check py_CBA-4Apr26-2.xlsb included in the download, showing very close agreement in all cases:

This file can be viewed without access to Python or any of the associated packages. Enter 1-15 in the “Span Type” cell (Y2) to view results from Strand7 and pyCBA on any of the 6 worksheets.

Posted in Beam Bending, Excel, Frame Analysis, Link to Python, Newton, PyXLL, Strand7, UDFs | Tagged , , , , , , , , , , , , | Leave a comment

… and then py_xlCBA 0.5

Following the previous post, more detailed checking found that the code was returning an error for beams with a support at X = 0. This has now been fixed, and the revised code and spreadsheets can be downloaded from:

py_xlCBA.zip

I have also added the files used for the detailed check, analysing 15 different span arrangements, each with 6 different support conditions, analysed in the file py_CBA-Check26-4.xlsb, and compared with Strand7 results for the same span arrangements and support conditions (Check Beam-pyCBA-all-Apr26.st7). The spreadsheet and Strand7 results are copied to Check py_CBA-4Apr26.xlsb, which is all numerical data and can be opened in Excel without Python.

The spreadsheet calculation of the 15 beams is shown below, with split-screen view (click image for full-screen view):

The segment definition, with a total beam length of 32 m, and the applied loading are the same for all cases, but the spreadsheet has 15 different ranges defining support locations, and each support has 6 different options for support type, including pinned, fixed, specified deflections and/or rotations or deflection and rotational stiffness. For each of the 6 support conditions the py_CBA function results for the 15 beams were copied to the summary spreadsheet:

The Strand7 results are also copied to the summary spreadsheet, where the plots show near identical results, with both analyses appearing as a single line. The results for each of the 15 different support arrangement can be viewed by entering 1-15 in cell Y2.

Posted in Beam Bending, Excel, Finite Element Analysis, Frame Analysis, Link to Python, Newton, PyXLL, Strand7, UDFs | Tagged , , , , , , , , , , | Leave a comment