Questions tagged [exponent]

Exponentiation is a mathematical operation, written as b raised to the power of n, involving two numbers, the base b and the exponent (or power) n.

Exponentiation refers to the mathematical operation involving two numbers, one is a base and another is an exponent. It is repeated multiplication. To calculate 53 you have to multiply the number 5 (base) by itself 3 times (exponent).

588 questions
19
votes
5 answers

Numpy matrix power/exponent with modulo?

Is it possible to use numpy's linalg.matrix_power with a modulo so the elements don't grow larger than a certain value?
John Smith
  • 11,678
  • 17
  • 46
  • 51
19
votes
4 answers

Convert numbers with exponential notation from string to double or decimal

Is there a fast way to convert numbers with exponential notation (examples: "0.5e10" or "-5e20") to decimal or double? Update: I found Parse a Number from Exponential Notation but the examples won't work for me unless I specified a…
OMGKurtNilsen
  • 5,048
  • 7
  • 27
  • 36
16
votes
3 answers

Java: Why can't I declare integer types using scientific notation?

I can easily read 2e15 as "two quadrillion" at a glance, but for 2000000000000000 I have to count the zeroes, which takes longer and can lead to errors. Why can't I declare an int or long using a literal such as 2e9 or 1.3e6? I understand that a…
odougs
  • 175
  • 1
  • 1
  • 6
15
votes
5 answers

Calculate (x exponent 0.19029) with low memory using lookup table?

I'm writing a C program for a PIC micro-controller which needs to do a very specific exponential function. I need to calculate the following: A = k . (1 - (p/p0)^0.19029) k and p0 are constant, so it's all pretty simple apart from finding x^0.19029…
Jeremy
  • 1,083
  • 3
  • 13
  • 25
13
votes
2 answers

Last digit of power list

Outline of problem: Please note I will abuse the life out of ^ and use it as a power symbol, despite the caret symbol being the bitwise XOR operator in JS. Take a list of positive integers, [ x_0, x_1, ..., x_n ] and find the last digit of the…
Nick Bull
  • 9,518
  • 6
  • 36
  • 58
13
votes
4 answers

Why does `a ^ b` return a numeric when both `a` and `b` are integers?

Given two integers: a <- 1L b <- 1L As I would expect, adding, subtracting, or multiplying them also gives an integer: class(a + b) # [1] "integer" class(a - b) # [1] "integer" class(a * b) # [1] "integer" But dividing them gives a…
flodel
  • 87,577
  • 21
  • 185
  • 223
11
votes
7 answers

Converting exponential to float

This is my code, trying to convert the second field of the line from exponential into float. outputrrd = processrrd.communicate() (output, error) = outputrrd output_lines = output.split('\n') for line in output_lines: m = re.search(r"(.*): ",…
StefanS
  • 261
  • 3
  • 4
  • 10
11
votes
2 answers

How do I raise X to the power of Y in Powershell?

I (apparently wrongly) assumed there would be a built-in power operator or function in Powershell, but I it seems there is not, or is there?
skeetastax
  • 1,016
  • 8
  • 18
10
votes
4 answers

R: How can I calculate large numbers in n-choose-k?

For a class assignment, I need to create a function that calculates n Choose k. I did just that, and it works fine with small numbers (e.g. 6 choose 2), but I'm supposed to get it work with 200 choose 50, where it naturally doesn't. The answer is…
Ronny Efronny
  • 1,148
  • 9
  • 28
10
votes
6 answers

PHP number abbreviator

Edit: Function below now does the abbreviation correctly, implemented @Asad 's solution Hi I am currently working on a like button, I've got all the base functionality working nicely however I have started the number abbreviation code and hit a wall…
André Figueira
  • 6,048
  • 14
  • 48
  • 62
9
votes
2 answers

Difference between math.exp(2) and math.e**2

While programming I noticed a difference between the result of math.exp(2) and math.e**2. As you can see below, this difference does not arise when calculating e^1. Not being an experienced programmer, I wondered why this differs? I assume it has…
0x0B1
  • 330
  • 1
  • 2
  • 10
9
votes
3 answers

Matrix power sum

What is the best way to calculate sum of matrices such as A^i + A^(i+1) + A^i+2........A^n for very large n? I have thought of two possible ways: 1) Use logarithmic matrix exponentiation(LME) for A^i, then calculate the subsequent matrices by…
ishan3243
  • 1,870
  • 4
  • 30
  • 49
8
votes
2 answers

Convert mantissa and exponent into double

In a very high performance app we find the the CPU can calculate long arithmetic significantly faster then with doubles. However, in our system it was determined that we never need more then 9 decimal places of precision. So we using longs for all…
Wayne
  • 2,959
  • 3
  • 30
  • 48
8
votes
2 answers

In laymans terms, what does the Python string format "g" actually mean?

I feel a bit silly for asking what I'm sure is a rather basic question, but I've been learning Python and I'm having difficulty understanding what exactly the "g" and "G" string formats actually do. The documentation has this to say: Floating point…
user1015937
  • 83
  • 1
  • 3
8
votes
3 answers

Compute the last (decimal) digit of x1 ^ (x2 ^ (x3 ^ (... ^ xn)))

I need to find the unit digit of x1 ^ (x2 ^ (x3 ^ (... ^ xn))) from integers passed into the function as a list. For example the input [3, 4, 2] would return 1 because 3 ^ (4 ^ 2) = 3 ^ 16 = 43046721 the last digit of which is 1. The function needs…
Harry Day
  • 378
  • 4
  • 13
1
2
3
39 40