Memorial day is 05/25/2015 – Orders will ship out on May 26th. There will not be any deliveries or shipping on Monday. Any order placed after 11am ET on Friday May 22nd will not start to ship out until Tuesday May 26th.

Howto calculate ln(x) with arduino?
Moderators: adafruit_support_bill, adafruit

Howto calculate ln(x) with arduino?

by Northriver on Thu Feb 04, 2010 9:41 am

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
Northriver
 
Posts: 3
Joined: Thu Feb 04, 2010 9:32 am

Re: Howto calculate ln(x) with arduino?

by bastard on Thu Feb 04, 2010 10:18 am

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
bastard
 
Posts: 54
Joined: Tue Aug 25, 2009 7:10 am
Location: Germany, Bavaria

Re: Howto calculate ln(x) with arduino?

by Northriver on Thu Feb 04, 2010 1:32 pm

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
Northriver
 
Posts: 3
Joined: Thu Feb 04, 2010 9:32 am

Re: Howto calculate ln(x) with arduino?

by hlantz on Thu Feb 04, 2010 2:30 pm

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?

by Northriver on Thu Feb 04, 2010 4:15 pm

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?
Northriver
 
Posts: 3
Joined: Thu Feb 04, 2010 9:32 am