exponential

awk: negative exponential is not correctly interpreted

孤者浪人 提交于 2020-06-16 03:37:38
问题 I have this table: a 0 b 0 c 1.6149e-315 d 5.2587e-265 e 8.2045e-227 f 8.2045e-227 If I type $awk '($2<1){print}' my_file.txt it returns a 0 b 0 d 5.2587e-265 e 8.2045e-227 f 8.2045e-227 but it considers the value in the third row, 1.6149e-315, to be larger than 1: $awk '($2>1){print}' my_file.txt c 1.6149e-315 Which is the reason for this behaviour? Is a negative exponential <1e-300 too small so it removes the "e-" part? It looks so, since $awk '($2>1.6149){print}' my_file.txt c 1.6149e-315

Approximation of e^x using Maclaurin Series in Python

拈花ヽ惹草 提交于 2020-06-01 12:40:56
问题 I'm trying to approximate e^x using the Maclaurin series in a function called my_exp(x) , I believe everything I've done so far is right but I'm getting incorrect approximations for whatever number I try. import math for i in range (x): exp = 1 + ((x**i)/math.factorial(i)) print(exp) For example, whenever I try my_exp(12) I get 18614.926233766233 instead of 162754.79141900392 Help? 回答1: Your problem is that the e^x series is an infinite series, and so it makes no sense to only sum the first x

Approximation of e^x using Maclaurin Series in Python

天涯浪子 提交于 2020-06-01 12:40:11
问题 I'm trying to approximate e^x using the Maclaurin series in a function called my_exp(x) , I believe everything I've done so far is right but I'm getting incorrect approximations for whatever number I try. import math for i in range (x): exp = 1 + ((x**i)/math.factorial(i)) print(exp) For example, whenever I try my_exp(12) I get 18614.926233766233 instead of 162754.79141900392 Help? 回答1: Your problem is that the e^x series is an infinite series, and so it makes no sense to only sum the first x

Java output double numbers in exponential format

半世苍凉 提交于 2020-05-13 06:11:25
问题 I have some double numbers that are outputted with this format: Format.String("%1.4e",doubleNumber); The result is 1.123456e+03 . How can I set the number of cipher of exponent for getting this format: 1.123456e+003 I would have always 3 cipher after e symbol. Thank you UPDATE 1: I have partially resolved: DecimalFormat formatter = new DecimalFormat("0.000000E000"); System.out.println( formatter.format(doubleNumber) ); Now the number has always the format 1.123456e0xx or 1.123456e-0xx But it

Simplifying the Big-O Complexity of this Exponential Algorithm

自闭症网瘾萝莉.ら 提交于 2020-05-11 06:50:20
问题 I have a counting algorithm for which I am trying to get a general big-o description. It is horribly nested and horribly exponential. Here it is: 1. For each T_i in T 2. For k = 1 to max_k 3. For each of 2^k*(n choose k) items 4. For each t in T_i 5. check if the item is in t...etc. Here is a line-by-line idea of each running time This is a simple partitioning and I'm going to just give it a constant c1. max_k is a small number, always less than n, perhaps around 4 or 5. I will use k below.

How to learn or find weight vector and remove outliers for all data point using Constrained np.polyfit or curve_fit?

橙三吉。 提交于 2020-04-30 09:19:07
问题 I am trying to fit a exponential decay to some experimental data and using polyfit in numpy. Also, fit itself is weighted, that is every data point has some weight associated with it and the polyfit function can find that optimal weights ? Referred: Constrained np.polyfit So final output would be coefficient value and the weight vector for every associated data points. Also I want to constrain M parameter between 0.9 to 1 and N to -0.001 to -0.009 Data: t(x) rate(y) 0 0.950 1 0.940 2 0.931 3

Exponentiation of real numbers

纵饮孤独 提交于 2020-01-07 05:43:22
问题 I've come across an interesting exercise and it says: Implement a function x^y using standard functions of Turbo Pascal For integer variables I can use for loop but I cannot understand how to work with real variables in this case. I've been thinking about how to do this using Taylor series (can't understand how to use it for exponentiation) and I also found out that x^y = exp(y*log(x)) but there is only ln (natural logarithm) in standard functions... PS I'm not asking you to write code: give

Exponential curve fitting with nls using data.table groups

不羁的心 提交于 2020-01-06 07:14:24
问题 I'd like to fit exponential curves to groups 1 & 2 in the data table shown below and obtain a new column containing the residual standard error corresponding to each group. The exponential curve should follow y=a*exp(b*x)+c ## Example data table DT <- data.table( x = c(1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8), y = c(15.4,16,16.4,17.7,20,23,27,35,25.4,26,26.4,27.7,30,33,37,45), groups = c(1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2) However, I only know how to fit nls curves and obtain the residual standard error

Algorithm Complexity and Efficiency, Exponential operation java

牧云@^-^@ 提交于 2020-01-04 06:35:41
问题 I have a list of strings. I have a set of numbers: {1, 2, 3, 4} and I need to generate all combinations(?) (strings) to check against my list, Combinations: (1, 2, 3, 4), (1234), (1, 2, 3, 4), (123, 4), (12, 34), (1, 2, 34), (1, 234), (1, 23, 4), (1, 23), (1, 2, 3), (1 2), ((1 2), (3 4))...etc. This problem grows larger as my set of numbers gets larger. Is it right that this is a bad problem to use recursion for? (that is what I have now) However, aren't the space requirements stricter for an

Fitting an exponential decay using a convolution integral -

狂风中的少年 提交于 2020-01-02 18:22:07
问题 I'm fitting the following data where t: time (s), G: counts, f: impulse function: t G f -7200 4.7 0 -6300 5.17 0 -5400 4.93 0 -4500 4.38 0 -3600 4.47 0 -2700 4.4 0 -1800 3.36 0 -900 3.68 0 0 4.58 0 900 11.73 11 1800 18.23 8.25 2700 19.33 3 3600 19.04 0.5 4500 17.21 0 5400 12.98 0 6300 11.59 0 7200 9.26 0 8100 7.66 0 9000 6.59 0 9900 5.68 0 10800 5.1 0 Using the following convolution integral: And more specifically: Where: lambda_1 = 0.000431062 and lambda_2 = 0.000580525 . The code used to