Arduino & Algebra

Will Arduino do Algebra calculations including exponent math functions?

Here is the example:

Pw = (RH/100)EXP(17.863-9621/(T+460))
W= 7000
0.62198/(29.92/Pw-1)

where RH= relative humidity % and T= Temperature (dry bulb)

This is to calculate Grains Per Pound of Air. Moisture content in air.

No, Arduino does not do algebra (symbolic manipulation).

But those formulas can be evaluated if you define all the variables as floats (Pw, RH, T, W) and provide reasonable values for the primary variables (RH and T). The name of the exponential function is exp.

Defining the variables I understand because I would be putting in temp and humidity from a BME280. I did look at exponential function and the meaning of symbolic manipulation. So it looks like it can be calculated.

I thought it was Algebra, but that’s what I get for thinking. Been a long time ago for math class. Just have to learn some of it all over again.

THANKS!

Algebra allows you to do and say things like this:

if A=B*C, then B=A/C.

KevinRoach:
Not sure I follow! I am not a mathematician. Defining the variables I understand because I would be putting in temp and humidity from a BME280.

Algebra is about manipulating symbols for numbers. It's about solving equations to isolate the unknown variables. Arduino can't do that.

What you want to do is just all the calculations. Arduino is GREAT at calculations.

As long as you have float type variables defined for Rh and T with reasonable values, what you want to do is trivially easy.

float Pw = (RH / 100.0) * exp(17.863 - 9621.0 / (T+460.0))
float W = 7000.0 * 0.62198 / (29.92 / Pw - 1)

Note how I put the ".0" on the end of most of the variables to make sure the compiler treats them with floating point math.

Now this isn't optimized by any definition, but it is easy to write. If you need it optimized for speed then we can work on that. For that you will have to do some algebra to rearrange those expressions, but you'll do that on paper and not in code.

What Arduino CAN'T do is actual algebra. If you gave it W it couldn't then solve for Pw from that equation. You'd have to rearrange the equation yourself on paper to get Pw = (some expression in terms of W) and then code that equation.

Ok! Got it! Sorry I updated my previous post. I was woried that Arduino would not be able to pull this of but that's great that I can do it.

Thanks!