# ghMath

Grasshopper component ghMath lets you read and execute the math calculations defined with sMath mathematical software (http://en.smath.com).

**The intention of this Grasshopper plugin is to prove the concept.** **And hopefully, promote a new approach in the way how design checks’ calculations could be done and recorded.**

If you have never came across sMath – it is basically MathCAD, just quicker and completely for free (free for commercial purposes as well, you can install it without admin rights).

So using ghMath you can define the “logic” of calculation using sMath and then rapidly iterate through many sets of input data to optimize the design (e.g using evolutionary solvers). Eventually, you can save the final calculations file as output. Few of potential uses for component are:

- Quickly implement math equations/logic into Grasshopper, without many grasshopper blocks. e.g. deflection and/or stress calculation;
- Use Galapagos/Ocotopus to to optimize the size of member for full utilization;
- Use this plugin in combination with Karamba or manual load take-down scripts to check/optimize elements.

As a feature in future, I intend to implement export to .html with results.

Currently, the plugin supports all basic math operators, pow, sqrt, min, max, log, and trigonometric functions. It does not support integrals, conditional statements, and any advanced features.

I have provided two relatively simple examples, more power can be unleashed by combining the plugin with reading input from excel using Lunchbox plugin, stepping through multiple calcs using Anemone, or Karamba combining analysis output with member checks with sMath.

**Background for creation of this plug-in:**

The idea of this plugin came from looking at different ways of producing design calculations. And none of them is ideal.

So what does the ideal “design calculation” looks like?

In this post I refer to “design calculation” as one in engineering that checks element/connection for compliance to code or first principles. e.g. reinforcement area calculation, steel column buckling check etc.

Software/approach independent points:

- Engineer should understand trust the calculation.
- Code references shown;
- Process should work well with other existing processes within the company.

Points where “visual software” (MathCAD, sMath, or hand calculations) are better

- The logic of calculation must be clearly described.
- Output should be visually well formatted with units described.
- The calculation must be easily check-able.
- Calculation should be adjustable to particular project needs.
- Inputs and outputs should be clearly indicated.

Points where Excel or custom-scripted calculation forms are better:

- Calculation should be able to perform checks for static results from many different software.
- Tools already developed allow to transfer data from majority of general FEA analysis packages to Grasshopper. e.g. check out the work of my former colleagues from BuroHappold https://bhom.xyz/
- Design calculations for many combinations/members should be automated.
- Calculation should be able to interact with optimization tools. e.g. evolutionary solvers.

Additional points:

- Saved calculation file must be in “open format” (.e.g. sMath saves data in XML, whereas Mathcad in “closed format”)

**ghMath and the general approach of creating “visual
calculation” and then pushing it through automation process aims to
combine the benefits of two software groups mentioned above.**