## Calculation and Analysis – What's wrong with \$ int_ {0} ^ { infty} x ^ { frac {-9} {8}} * e ^ {- 16 * x ^ { frac {-1} {8 }} – frac {2 * x} {0.5 ^ {9}} dx \$?

In Mathematica 9, I want to evaluate the following integral:

$$int_ {0} ^ { infty} x ^ { frac {-9} {8}} * e ^ {- 16 * x ^ { frac {-1} {8}} – frac {2 * x} {0,5 ^ {9}}} dx$$

The result should be positive. Mathematica, however, gives me -0.0824979 (a negative number).

This is the code of Mathematica in the InputForm:

Integrate (E ^ (- 16 / x ^ 8 ^ (- 1) –
(2 * x) / 0.5 ^ 9) / x ^ (9/8),
{x, 0, infinity})

So I do not think I entered a wrong formula.

Could someone help me answer why Mathematica gave me a wrong answer?

Many thanks.

## Mining Calculation – Bitcoin Stack Exchange

My goal is to understand Bitcoin.

I read what happens during a transaction and have some questions about it:

1) This is what I understood, but I'm not sure: when a transaction takes place, the miners calculate a value that is cold "prof of work". This value is calculated to get a 0 value (or a value that is very close to 0) for the hash of the value + of transaction + of the last push. That's it ?

2) How is the calculation done? Is it basically a raw force? I mean, try one hash, then another, and so on.

3) I have read that this calculation takes about 10 minutes. That is, people who do the transaction should wait 10 minutes? (Imagine, I would like to buy a drink with Bitcoin.) The waiter should wait 10 minutes to make sure the transaction is in order before he gives me a beer?

4) The miners' job is thus to calculate a working professional. But I read that the miner also discovered new bitcoins. Is it another form of mining? I do not see the connection between the POW calculation and the new bitcoins.

5) One day I read that there will be no Bitcoin for me anymore. But will we ever need miners to help prisoners of war? It is something strange for me.

Many thanks

## Math – Distance calculation when switching between two speeds

There are two speed values ​​used by moving objects. After a while, it switches from V1 to V2. I need the formula that can be used to calculate the current distance (at a given time).

Input variables:

constants:

• V1 – first gear
• V2 – second speed
• Ts switching time between V1 and V2
• P – switching capacity

Output variables:

I tried to use the following formula:
`S = Lerp(Clamp(T / Ts, 0, 1) ^ P), V1, V2) * T`

In this case, however, the moving object is returned after some time and moves forward again.

Should an acceleration be used in the formula?

## Computer architecture – calculation of cache allocation

A cache has the following specifications:
Block size = 16 bytes
Set size = 2 way set associative
Number of sentences = 128

My questions are:
1] How many blocks main memory contains?
2] How much extra memory is needed for the cache?

## object-oriented – calculation of the first n primes: An example from Clean Code, revised for C ++

I try to improve on examples Clean up the code* while being implemented again in C ++. This time it is the best calculation example for the sieve of Eratosthenes from pp. 71-74.

Below is the original for C ++ adapted without any improvements:

.H

``````class PrimeGenerator {
public:
PrimeGenerator() = default;
~PrimeGenerator() = default;

static std::vector generatePrimes(unsigned maxValue);

private:
static void uncrossIntegersUpTo(unsigned maxValue);
static void crossOutMultiples();
static unsigned determineIterationLimit();
static void crossOutMultiplesOf(unsigned i);
static bool notCrossed(unsigned i);
static void putUncrossedIntegersIntoResult();
static unsigned numberOfUncrossedIntegers();

static std::vector crossedOut;
static std::vector result;
};
``````

cpp

``````std::vector PrimeGenerator::crossedOut;
std::vector PrimeGenerator::result;

std::vector PrimeGenerator::generatePrimes(unsigned maxValue)
{
if (maxValue < 2)
return {};

uncrossIntegersUpTo(maxValue);
crossOutMultiples();
putUncrossedIntegersIntoResult();
return result;
}

void PrimeGenerator::uncrossIntegersUpTo(unsigned maxValue)
{
crossedOut = std::vector(maxValue + 1, false);
crossedOut(0) = true;
crossedOut(1) = true;
}

void PrimeGenerator::crossOutMultiples()
{
unsigned limit = determineIterationLimit();
for (size_t i = 2; i <= limit; ++i)
{
if (notCrossed(i))
crossOutMultiplesOf(i);
}
}

unsigned PrimeGenerator::determineIterationLimit()
{
// Every multiple in the array has a prime factor that
// is less than or equal to the root of the array size,
// so we don't have to cross out multiples of numbers
// larger than that root.
double iterationLimit = std::sqrt(crossedOut.size());
return static_cast(iterationLimit);
}

void PrimeGenerator::crossOutMultiplesOf(unsigned i)
{
for (size_t multiple = 2 * i; multiple < crossedOut.size(); multiple += i)
{
crossedOut(multiple) = true;
}
}

bool PrimeGenerator::notCrossed(unsigned i)
{
return !crossedOut(i);
}

void PrimeGenerator::putUncrossedIntegersIntoResult()
{
result = std::vector(numberOfUncrossedIntegers());
size_t j = 0;
for (size_t i = 2; i < crossedOut.size(); ++i)
{
if (notCrossed(i))
result(j++) = i;
}
}

unsigned PrimeGenerator::numberOfUncrossedIntegers()
{
unsigned count = 0;
for (size_t i = 2; i < crossedOut.size(); ++i)
{
if (notCrossed(i))
count++;
}

return count;
}
``````

What we see here is a static class with static functions and members. We do not like these in C ++, so it seems that this code could be better served with a namespace and some free functions. Let's try it - my attempt to improve goes further down.

.H

``````namespace PrimeGenerator
{
std::vector generatePrimes(unsigned maxValue);
}
``````

cpp

``````namespace {

std::vector uncrossIntegersUpTo(int maxValue)
{
std::vector crossedOut(maxValue + 1, false);
crossedOut(0) = true;
crossedOut(1) = true;

return crossedOut;
}

unsigned determineIterationLimit(size_t size)
{
// Every multiple in the array has a prime factor that
// is less than or equal to the root of the array size,
// so we don't have to cross out multiples of numbers
// larger than that root.
double iterationLimit = std::sqrt(size);
return static_cast(iterationLimit);
}

void crossOutMultiplesOf(unsigned i, std::vector& crossedOut)
{
for (size_t multiple = 2 * i; multiple < crossedOut.size(); multiple += i)
{
crossedOut(multiple) = true;
}
}

void crossOutMultiples(std::vector& crossedOut)
{
unsigned limit = determineIterationLimit(crossedOut.size());
for (size_t i = 2; i <= limit; ++i)
{
if (!crossedOut(i))
crossOutMultiplesOf(i, crossedOut);
}
}

std::vector putUncrossedIntegersIntoResult(const std::vector& crossedOut)
{
std::vector result;
for (size_t i = 2; i < crossedOut.size(); ++i)
{
if (!crossedOut(i))
result.push_back(i);
}

return result;
}

}

namespace PrimeGenerator {

std::vector generatePrimes(unsigned maxValue)
{
if (maxValue < 2)
return {};

auto crossedOut = uncrossIntegersUpTo(maxValue);
crossOutMultiples(crossedOut);
return putUncrossedIntegersIntoResult(crossedOut);
}

}
``````

A short summary of the changes:
- I have removed the class and left a single interface function in a `PrimeGenerator` Namespace.
- The `numberOfUncrossedIntegers()` Function did not seem to make much sense, so I reworked it `putUncrossedIntegersIntoResult(...)` Get rid of the former.
- `notCrossed(...)` Would have to have two parameters now, so it makes no sense. It's gone now.

Now I have two questions about my code. First of all we have to do that now `crossedOut` Vector around, which is a disadvantage compared to the previous design. Would you suggest an alternative solution to mitigate this? Second, are there any additional places I should have worked? `size_t` instead of `unsigned`?

Bottom up!

* Clean Code: A manual for agile software craftsRobert C. Martin

## GPU calculation AMD – Mathematica Stack Exchange

I am new to this forum, although it has helped me a lot in the last few months. I am working on hypergeometric functions and would like to use my GPU as support. I have a Radeon R9 390, but I can not use it for Mathematica.

I am using Mathematica 11.2, Windows 7, and the driver of my graphics cards indicates that the OpenCL API version is 2.0

``````OpenCLQ[]
``````

returns "Wrong".
Anyone have suggestions what I could try?

## multivariable calculation – max-min and min-max equivalence for the optimization problem

I have the following max-min problem:

$$underset {{ bf X}} { text {max}} ; ; underset {k} { text {min}} ; || { bf A} _k { bf x} _k || ^ 2_2$$

from where $${ bf X} = ({ bf x} _1, dots, { bf x} _K) in mathbb {C} ^ {N times P}$$ and $${ bf A} _k = ({ bf a} _1, dots, { bf a} _M) ^ H in mathbb {C} ^ {M times N}$$,

Suppose I have a cap on $$| { bf a} _m ^ H { bf x} _k | leq u_m$$, then define $${ bf U} = ({u} _1, dots, {u} _M) ^ T in mathbb {R} ^ {M times 1}$$ I can write

$$underset {{ bf X}} { text {max}} ; ; underset {k} { text {min}} ; || { bf A} _k { bf x} _k || ^ 2_2 Leftrightarrow underset {{ bf X}} { text {min}} ; underset {k} { text {max}} ; {|| | { bf A} _k { bf x} _k | – { bf U}} || ^ 2_2$$

That is to maximize the minimum $$|| { bf A} _k { bf x} _k || ^ 2_2$$ over $$k$$ corresponds to the minimization of the maximum arithmetic error between $$(| { bf A} _k { bf x} _k | – { bf U})$$ over $$k$$?

## Algorithm – Calculation of the outer polygon

I need to compute an outer polygon from a self-intersecting polygon. I've found that Mathematica has recently implemented the following feature that could solve this problem. Does anyone know how it could be implemented?

https://reference.wolfram.com/language/ref/OuterPolygon.html

Any book or article dealing with this topic would also be helpful.

To illustrate my problem, I have a self-cutting polygon (blue) and want to get the outer polygon (red):

If it helps, this polygon is created by "displacing" * a previous polygon that did not overlap itself:

Could there be a way to increase the polygon that considers self-overlapping?

Thanks a lot!

* not technically balancing, as only some parts of the polygon move in the normal direction.

## iptables – The correct calculation of –limit and –limit-burst

Could someone please advise me how to calculate the correct numbers for –limit and –limit-burst for a particular server with certain parameters? For example:

``````iptables -A INPUT -p tcp -m state --state NEW -m limit --limit 2/second --limit-burst 2 -j ACCEPT
iptables -A INPUT -p tcp -m state --state NEW -j DROP
``````

The INPUT directive accepted. How do I calculate the numbers? – Limit 2 / second or Limit 2 / Minute – Limit Burst 2 or 5? Are there any formulas based on the parameters / performance of my server?

Would be grateful for any help / suggestions / suggestions.

## Complexity of the calculation of \$ f ^ {(n)} (0) \$ / Extracting a coefficient of a function series

Many combinatorial problems can be solved using generation functions.

In such a case, we get a function $$f (x)$$that (usually) has a Taylor expansion:
$$f (x) = sum_ {n ge 0} a_n x ^ n$$
Thus the coefficients $$a_n$$ are exactly the elements of the sequence we are looking for.

Furthermore, we can assume that the function $$f (x)$$ is given in closed form, d. H. as a finite function constructed using only elementary functions.

Unlike the determination of Taylor expansion, we now want a single coefficient $$a_k$$fixed for some $$k$$,

What is the most efficient way to do this?

I've already asked the question on math.stackexchange, where I got an answer to which I am bound $$mathcal O (log_2 (n) ^ alpha)$$ is possible. However, I can not figure out from the answer how this limit is established.