# Using Mathematica to save the world

Well, one person’s world of torsion anyway…

In this post I’ll show how to use Mathematica to check some derivatives of torsion relationships.

Mathematica is an analysis/computational tool by Wolfram. Now if you had to pony up the dollars for it you’d be out a few thousand dollars, but as it happens I’m cheap and it’s free on Raspberry Pi’s Raspbian operating system. Yes it’s linux based, but don’t let that turn you off, it’s so simple to setup anyone could do it.

I have zero idea if the Raspberry Pi version is feature limited in any way, in comparison to getting fleeced for some serious coin. But free is free, and so far I’ve not had any issues solving anything I throw at it.

The downside of running on such low power hardware is that it can take time to solve anything mildly complex, but you live with it for the price.

Why are we doing this, we’ll in this EngTips post the poster seemed to show some disagreement with the published solutions which were kindly provided by AISC in the paper titled ‘* Technical Note: Torsional Analysis of Steel Sections, 2002 Engineering Journal, fourth quarter*‘. A search of the internet should easily yield you a copy, or download a version from the linked thread.

So let’s set about seeing if we agree or not with the AISC answers by undertaking the necessary derivatives in Mathematica.

Let’s pick on case 11, as it was identified as having an incorrect sign in one of the terms. So i’ll take my own advice and “just” do the derivatives. Easy right….

With Mathematica to the rescue (read it’s been a while since I had to use calculus in anger and cannot remember how or words to that effect)…. Easy right (now) …

If I had to compare Mathematica to something I’d say it’s sort of Mathcad like in the way you enter problems. There also seems to be a wealth of information on the Internet related to running analyses which is pretty helpful to get a handle on the exact nomenclature to use. It’s a bit finicky about this, one thing out of place and you’ll be graced with a non descript error or nothing occurring when you evaluate your expressions. With little or no idea what you did wrong. Similarly for some reason the nomenclature Mathematica uses differs slightly from the online Wolframalpha site which is based on the same analysis engine (both must have been designed by engineers right).

One other thing, while Wolframalpha might be able to be used, you’ll reach a limit on what it can do before it asks you for dollars as you may hit an arbitrary computation limit depending on how complex the expressions are that you are trying to evaluate. But the free on Raspberry Pi version doesn’t seem to have any such limitations (as far as I’m aware).

So anyway, for case 11, the angle is given as:-

where

Well bugger me if I had to differentiate that obscenity by hand to find or or even , I’m the first to admit I don’t even know where to start simply because it looks intimidating. Oh my cosh hyperbolic functions scare me alright, it’s pretty hard to take a sinh to them… bad, but had to be done.

AISC formulas for the derivatives are given below:-

So lets see if Mathematica gives us the same answers, this is the code you’d enter for taking the first/second & third derivative of the function. The simply means you are using the previous answer ‘‘ as an input and differentiating this with respect to , similarly would mean using the answer from two answers previous.

Just enter these into Mathematica, one after the other and select *Evaluation>Evaluate Notebook* from the menus to solve.

Then a few seconds later we’ll get the following answers, original function, first, second and third derivatives:-

While they take a slightly different form, I can assure you with some simplification they give the same answer as the AISC output apart from the second derivative which does indeed seem to contain an incorrect sign. For example:-

By factoring out and simplifying the variables, and recognising that , and throw in some rearranging of the location of the terms then this answer simplifies to the following expression:-

Which is the same as the AISC answer….QED.

Similarly for the second derivative we can take the Mathematica answer given below and simplify it to the second expression in a similar manner:-

Which as you’ll note has a term while the AISC answer has a . No QED!, no cigar!…

Finally the third derivative can be simplified in a similar manner by rearranging the terms and replacing the term:-

### Conclusion

World saved. Job done.

Seems like there is actually an error in the AISC formula, don’t believe everything you find on the internet I guess.

But more importantly we’ve shown how simple it is to use Mathematica to evaluate derivatives. It’s far more powerful than this of course.

So grab yourself a Raspberry Pi to check it out for a few dollars, or alternatively spend a few thousand dollars for a desktop version.

### [EDIT] …Wait a minute….

Well this is embarrassing, it seems in September 2019 AISC updated their errata for Design Guide 9. It includes the following correction to Case 11 (and a few others being questioned in the original EngTips post):-

So like I said don’t believe everything you find on the internet, inclusive of the original post above!

This correction of course impacts on all the derivatives, which are given below for completeness:-

These simplfy down to the following expressions in a similar form to that originally given by AISC:-

### Conclusion #2

So in conclusion (again), if you think you’ve found an error in something check in the first instance for an errata by the publisher. Then run screaming for the internet and Google.