Howto calculate ln(x) with arduino?

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
Northriver
 
Posts: 3
Joined: Thu Feb 04, 2010 9:32 am

Howto calculate ln(x) with arduino?

Post by Northriver »

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

bastard
 
Posts: 54
Joined: Tue Aug 25, 2009 7:10 am

Re: Howto calculate ln(x) with arduino?

Post by bastard »

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?

Post by Northriver »

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



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

User avatar
hlantz
 
Posts: 115
Joined: Wed Oct 14, 2009 3:14 pm

Re: Howto calculate ln(x) with arduino?

Post by hlantz »

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

Re: Howto calculate ln(x) with arduino?

Post by Northriver »

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


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?

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”