Exponent of E

Hello all,

How can I write the following formula: y = -2E-05x6 + 0.001x5 - 0.036x4 + 0.410x3 - 2.215x2 + 3.715x + 20.01
The problem is the exponent of E

-2E-5 = -0.00002

Have a look at the http://www.cplusplus.com/reference/clibrary/cmath/pow/ function :slight_smile:

The format nEm is non-superscript-capable printer shorthand for (n * 10m) ("Scientific notation")

So like Paul said, -2E-5 = -2 * 10-5 = -0.00002
(and the speed of light is 3E8 m/s = 3*108 m/s,
and a 0.1 microfarad cap = 1E-7 Farads.)

Calculators also tend to use this format.

And the arduino compiler will accept it just as you've written it:

Serial.print(-2E-5 * 1234, 6);
produces:
-0.024680

Wait a second...

I thought we were talking about e = 2,71828183 ?

If that is the case then -2e^-5 = -0.0135 else I'll forever hold my peace.

As the other posters stated, that is a common way to write scientific notation when there is no "^" after the E.

2E-5 = 0.00002

e^-5 would be a way to write e-5 and can be done with the exp(-5) function.

Thank you guys for the answers, but my doubt was exactly that, if the value of E = 2,71828183 or if the value is -0.00002.

I'm using a program called Origin to find the equation of a curve and the result came as y = -2E-05x6 + 0.001x5 - 0.036x4 + 0.410x3 - 2.215x2 + 3.715x + 20.01

Now I know that the value is really -0.00002.

Thank you again.

Hi Crystal

Are you sure that a 6'th order polynomium is the best fit? How did your curve originate or do you know if there is any phycics behind?

It's my experiance that Origin often can fit to better function with lower number of konstants.

-Fletcher

Hi Fletcher,

I´m measuring the temperature (nitrogen K degrees) with a diode, and I needed to divide the curve in two parts in order to work, one 3´th order the other 5´th order.

You´re right, I tried 7´th, 8 ´th and 9th orders and the best fit was the 6´th below 6 is not so good.

I also tried to fit the curve with excel but Origin did a best work.

Cristal

Hi Crystal,

I'm not sure how the output change of a diode is at low temperature. If I had a free guess I would have extimeted liniary :wink:

Splitting the curve in 2 parts is often a bad idea since you might get problems in the point where the 2 models overlap (eg. do the give the same value).

Since you are talking about a split - how many datapoints do you have (hopefull more than 11 (4+7))? Is it a wide range or a narrow one?

Btw, just out of interest - How are you cooling the nitrogen below then boiling point at atm. pressure?

-Fletcher

Hi Fletcher,

Take a look here to give an idea how is the curve and the values:
(My curve is not so linear, but my curve is similar to that)

http://www.lakeshore.com/temp/sen/sd400_ts.html#curve10

In my case I have almost 70 datapoints, that I received for the guy that I´m trying to make a display, instead using a voltmeter to view the temp.

He has a machine that uses nitrogen to cold some wires, (I do not know exactly what the machine does) he uses something called coldhead to maintain the nitrogen temperature, and I know the preassure inside the (Closed) tank is about 10 PSI

Jose

Hello
I have the problem like Cristal. I need to count position on curve, but my formula contains exponent 10^ -16. I try to compute it by arduino, but it make me only pure zero.So what do you think? Is it that, because arduino is not posible to count this "long" number ?
Here is my formula:
y = 2E-16x6 - 4E-13x5 + 4E-10x4 - 2E-07x3 + 4E-05x2 - 0,002x + 0,3284
Thanks for tips.

2E-16 is 0 on an Arduino. It does not have a double type that would allow you to accurately store 2E-16 (or 4E-13 or 4E-10). 2E-7 is pushing it.

So if I multiply every exp by 10^7, the " bigest " exponent will be 10^ -9 and than it will be aple to compute this ? And on the end, of corse, multiply result by 10^ -7 to get corect number.

I've come in a little late but...
@PaulS -- Sorry sir, but you're giving the wrong impression here.
The value 2e-16 is NOT zero on the Arduino. Try this

{
   float x;
   x = 2.0e-16;
   Serial.println(x, 18);
}

Mine prints 0.000000000000000200

Unfortunately, the Arduino print functions do not properly handle small
numbers and allow them to be printed in scientific notation.Variables of
type float allow for numbers as small as 1.0*10^-149, or 1.0e-149.

Keep in mind that if i add 1.0 to 1.0e-149 (10**-149), the resulting
number will be 1.0 simply because the type float only permits about
6 significant digits. That 1.0e-149 portion gets chopped off because
retaining it is beyond the precision of float. As a matter of fact,

x = 1.0e-140 + 1.0e-149;

will get you 1.0e-140 but

x = 1.0e-145 + 1.0e-149;

will have a value of x being 1.0001e-145 .

Maybe this will help people dealing with small numbers.
The curious may wish to read the 'IEEE_floating-point_standard'
and 'Significant_digits' pages on Wikipedia.org.

Wow! I don't what I ate but I was having some serious brain flatulence when I wrote the above post.

Variables of type float allow for numbers as small as 1.0*10^-45 (but they are "subnormal").
Still, ignoring the bad "magnitude" of these numbers the lessons are still correct.

Sorry 'bout that. :frowning: