"It's log, it's log, it's big, it's heavy, it's wood . . ."

Sorry, I went a little Ren and Stimpy just then. I have the following formula that works just dandy in my Arduino IDE and sketches:
dew point = (243.12 * ((log(Humid / 100.0)

  • ((17.625 * getTemp) / (243.12 + getTemp))) / ((17.625 - log(Humid / 100.0))
  • ((17.625 * getTemp) / (243.12 + getTemp)))));

My question is . . . what do I replace "log" with in my MIT App Inventor math block toolbox? I am using the numeric 2.718281828459 (Euler's number) but I really do not understand the numeric specificities in logs. I am attaching a clear png. of my math block which I believe to be correct, save for my misunderstanding of "log." My gratitude to the math wizard who can guide me.

There is a log block. Drag the square root block onto the screen, and expand the drop-down menu.

According to this formula from

How to calculate dew point? How to calculate relative humidity?

Many equations describing this relationship have been formed. None of them are perfect, though. This dew point calculator uses the Magnus-Tetens formula (based on the article by Mark G. Lawrence from 2005) that allows us to obtain accurate results (with an uncertainty of 0.35 °C) for temperatures ranging from -40 °C to 50 °C.

The dew point is calculated according to the following formula:

Ts = (b × α(T,RH)) / (a - α(T,RH))

where:

  • Ts — Dew point (in degrees Celsius);
  • T — Temperature (in degrees Celsius);
  • RH — Relative humidity of the air (in percent);
  • a and b are the Magnus coefficients. As recommended by Alduchov and Eskridge, the value of these are: a = 17.625 and b = 243.04 °C; and
  • α(T,RH) = ln(RH/100) + aT/(b+T).

These blocks should work:


dew_point.aia (4.1 KB)

P.S. On further thought, I should have used a local variable for alpha instead of a value function, to confine its name scope to the Ts function.

You might have other alphas in other formulas and this would keep them separate.

1 Like

https://mathshistory.st-andrews.ac.uk/HistTopics/e/

I figured I would give you a history of e while I was on a roll.

By the way, AI2 math supports complex numbers, allowing you to verify numerically that famous Euler equation

e ^ (i * Pi) = -1

image
So that's accurate within 3.6 billionths.

Draggable blocks:
blocks


i

1 Like

Thank you for that. Another MIT mystery solved!

Thank you for those demonstration blocks translating a formula into something digestible. . I am still rather fearful of the purple blocks, call, et al.

Thank you for turning my fuster-cluck formula into a neat and orderly layout. I learned some more by following it. When to use the orange blocks and the ubiquitous "get" command still eludes me.