Questions tagged [exp]

The Exponential - aka exp(x) function

The vast majority of the 21 posts tagged [exp] relate to the Exponential function i.e. f(x) = e^x where e is the number which is approximately 2.71828. This function is very important in statistics and many other fields.

235 questions
136
votes
3 answers

What exactly does numpy.exp() do?

I'm very confused as to what np.exp() actually does. In the documentation it says that it: "Calculates the exponential of all elements in the input array." I'm confused as to what exactly this means. Could someone give me more information to what it…
bugsyb
  • 5,662
  • 7
  • 31
  • 47
57
votes
7 answers

How can I use "e" (Euler's number) and power operation?

How can I write 1-e^(-value1^2/2*value2^2) in Python? I don't know how to use power operator and e.
Thanos Smar
  • 631
  • 1
  • 8
  • 12
34
votes
4 answers

Fast fixed point pow, log, exp and sqrt

I've got a fixed point class (10.22) and I have a need of a pow, a sqrt, an exp and a log function. Alas I have no idea where to even start on this. Can anyone provide me with some links to useful articles or, better yet, provide me with some…
Goz
  • 61,365
  • 24
  • 124
  • 204
27
votes
6 answers

Deal with overflow in exp using numpy

Using numpy, I have this definition of a function: def powellBadlyScaled(X): f1 = 10**4 * X[0] * X[1] - 1 f2 = numpy.exp(-numpy.float(X[0])) + numpy.exp(-numpy.float(X[1])) - 1.0001 return f1 + f2 This function is evaluated a huge…
kiriloff
  • 25,609
  • 37
  • 148
  • 229
26
votes
7 answers

Fast Exp calculation: possible to improve accuracy without losing too much performance?

I am trying out the fast Exp(x) function that previously was described in this answer to an SO question on improving calculation speed in C#: public static double Exp(double x) { var tmp = (long)(1512775 * x + 1072632447); return…
Anders Gustafsson
  • 15,837
  • 8
  • 56
  • 114
20
votes
2 answers

Why does my Visual C++ .exe project build create .lib and .exp files?

I have a solution consisting of 3 projects. One is a static library, and two are console-based .exe files that depend on and link against this library. Their settings seem to be identical. I build one of them: 1>------ Build started: Project:…
neuviemeporte
  • 6,310
  • 10
  • 49
  • 78
12
votes
3 answers

I do *not* want correct rounding for function exp

The GCC implementation of the C mathematical library on Debian systems has apparently an (IEEE 754-2008)-compliant implementation of the function exp, implying that rounding shall always be correct: (from Wikipedia) The IEEE floating point standard…
Rémi Peyre
  • 410
  • 3
  • 12
8
votes
2 answers

Why a self-written Rcpp vectorized mathematical function is faster than its base counterpart?

OK, I know the answer, but being inspired by this question, I'd like to get some nice opinions about the following: Why the Rcpp exercise below is ca. 15% faster (for long vectors) than the built-in exp()? We all know that Rcpp is a wrapper to the…
gagolews
  • 12,836
  • 2
  • 50
  • 75
8
votes
2 answers

Numerically Stable Implementation

I need to compute a normalized exponential of a vector in Matlab. Simply writing res = exp(V)/sum(exp(V)) overflows in an element of V is greater than log(realmax) = 709.7827. (I am not sure about underflow conditions.) How should I implement it…
user25004
  • 1,868
  • 1
  • 22
  • 47
8
votes
1 answer

Analytical way of speeding up exp(A*x) in MATLAB

I need to calculate f(x)=exp(A*x) repeatedly for a tiny, variable column vector x and a huge, constant matrix A (many rows, few columns). In other words, the x are few, but the A*x are many. My problem dimensions are such that A*x takes about as…
bers
  • 4,817
  • 2
  • 40
  • 59
8
votes
2 answers

when to use expm1 instead of exp in java

I am confused about using expm1 function in java The Oracle java doc for Math.expm1 says: Returns exp(x) -1. Note that for values of x near 0, the exact sum of expm1(x) + 1 is much closer to the true result of ex than exp(x). but this page…
Masood_mj
  • 1,144
  • 12
  • 25
7
votes
1 answer

Using AVX instructions disables exp() optimization?

I am writing a feed forward net in VC++ using AVX intrinsics. I am invoking this code via PInvoke in C#. My performance when calling a function that calculates a large loop including the function exp() is ~1000ms for a loopsize of 160M. As soon as I…
AronMiller
  • 202
  • 1
  • 8
7
votes
1 answer

Why do I get platform-specific result for std::exp?

I have a program that were giving slithly different results under Android and Windows. As I validate the output data against a binary file containign expected result, the difference, even if very small (rounding issue) is annoying and I must find a…
jpo38
  • 20,821
  • 10
  • 70
  • 151
7
votes
2 answers

How to represent e^(-t^2) in MATLAB?

I am a beginner in MATLAB, and I need to represent e(-t2). I know that, for example, to represent ex I use exp(x), and I have tried the following 1) tp=t^2; / tp=t*t; x=exp(-tp); 2) x=exp(-t^2); 3) x=exp(-(t*t)); 4) x=exp(-t)*exp(-t); What is the…
user573382
  • 343
  • 3
  • 10
  • 22
6
votes
6 answers

Disappointing performance in Ubuntu for computational workload

I've found rather poor performance running some computational code under Ubuntu on a brand new headless workstation machine I'm using for scientific computation. I noticed a difference in speed running some slightly complex code on Ubuntu versus on…
L Aslett
  • 420
  • 3
  • 7
1
2 3
15 16