Hi,

I´am doing a weather station using arduino.

I need to calculate ln(x)

How do I write the code to calculate ln(x)?

Best regards

Northriver

Moderators: adafruit_support_bill, adafruit

5 posts
• Page **1** of **1**

Howto calculate ln(x) with arduino?

Hi,

I´am doing a weather station using arduino.

I need to calculate ln(x)

How do I write the code to calculate ln(x)?

Best regards

Northriver

I´am doing a weather station using arduino.

I need to calculate ln(x)

How do I write the code to calculate ln(x)?

Best regards

Northriver

- Northriver
**Posts:**3**Joined:**Thu Feb 04, 2010 9:32 am

Re: Howto calculate ln(x) with arduino?

Read the manual:

The AVR math library, which is included in your sketch by using the line

#include <math.h> // (no semicolon)

Includes a great number of useful mathematical functions, including trigonometric, and logarithmic functions.

[...]

Bye

Stefan

The AVR math library, which is included in your sketch by using the line

#include <math.h> // (no semicolon)

Includes a great number of useful mathematical functions, including trigonometric, and logarithmic functions.

[...]

Bye

Stefan

- bastard
**Posts:**54**Joined:**Tue Aug 25, 2009 7:10 am**Location:**Germany, Bavaria

Re: Howto calculate ln(x) with arduino?

Thanks for reply Stefan,

But I can´t find ln(x) in the math.h library.

only:

double log (double __x)

double log10 (double __x)

Best regards

Northriver

But I can´t find ln(x) in the math.h library.

only:

double log (double __x)

double log10 (double __x)

Best regards

Northriver

bastard wrote:Read the manual:

The AVR math library, which is included in your sketch by using the line

#include <math.h> // (no semicolon)

Includes a great number of useful mathematical functions, including trigonometric, and logarithmic functions.

[...]

Bye

Stefan

- Northriver
**Posts:**3**Joined:**Thu Feb 04, 2010 9:32 am

Re: Howto calculate ln(x) with arduino?

Northriver wrote:Thanks for reply Stefan,

But I can´t find ln(x) in the math.h library.

only:

double log (double __x)

Isn't that what you're looking for?

From the math.h manual page:

double log (double __x) // natural logarithm of x

Natural logarithm of x = ln(x), right?

- hlantz
**Posts:**115**Joined:**Wed Oct 14, 2009 3:14 pm**Location:**Falun, Sweden

Re: Howto calculate ln(x) with arduino?

Thanks again Stefan,

I was trying to calculate the Dew Point

I found the correct formula.

H = (log10(RH)-2.0)/0.4343+(17.62*t)/(243.12+t);

td = 243.12*H/(17.62-H);

RH = Humidity in %

t=temperature in celcius

td= dew point temperature in celsius

Best regards

Northriver

I was trying to calculate the Dew Point

I found the correct formula.

H = (log10(RH)-2.0)/0.4343+(17.62*t)/(243.12+t);

td = 243.12*H/(17.62-H);

RH = Humidity in %

t=temperature in celcius

td= dew point temperature in celsius

Best regards

Northriver

hlantz wrote:Northriver wrote:Thanks for reply Stefan,

But I can´t find ln(x) in the math.h library.

only:

double log (double __x)

Isn't that what you're looking for?

From the math.h manual page:

double log (double __x) // natural logarithm of x

Natural logarithm of x = ln(x), right?

- Northriver
**Posts:**3**Joined:**Thu Feb 04, 2010 9:32 am

5 posts
• Page **1** of **1**