## Numerically integrating a highly oscillatory function

I’m trying to evaluate

`NIntegrate(Sin(x) Exp(I m (x + Cos(x) + Sin(x))), {x, 1, 100})`

with m=1000. The problem is that it’s highly oscillatory. What would be the best method to do this integral?

Posted on Categories Articles

## Why is an infinite product equal to 0 or infinite if lim uₙ is numerically greater than 1?

With an infinite product
pₙ = (1 + u₁) (1 + u₂) … (1 + uₙ)
Why does lim uₙ numerically greater than 1 mean that lim pₙ is either zero or infinite?

Posted on Categories Articles

## Probability or Statistics – Numerically inverting characteristic function with inverse Fourier transformation

I'm trying to numerically invert this characteristic function

`````` cf = (((-I)*t + n*((Lambda) + (Mu)) - n*Sqrt(-4*(Lambda)*(Mu) + (I*t - n*((Lambda) + (Mu)))^2/n^2))/(n*Sqrt((Lambda)*(Mu)*(Rho))))^n/2^n
``````

about a numerical inverse Fourier transform that looks like this …

`````` Re((1/(2*Pi))*NIntegrate(cf/. {(Lambda) -> 0.5, (Mu) -> 1, (Rho) -> 0.5, n -> 5}, {t, -Infinity, 0, Infinity}, Method -> DoubleExponential))
``````

But I keep getting errors that the integral at the borders cannot be evaluated.
Does anyone have any recommendations on how to calculate this thing so that I can get numeric?
Values?

Posted on Categories Articles

## numerical methods – numerically calculate the product of a sum of exponentials

To let $$d in mathbb N$$, $$beta in (0.1)$$ and $$sigma in (0.1)$$. I have to do the math $$u & # 39; (x & # 39 ;, y & # 39;): = beta + (1- beta) prod_ {i = 1} ^ d psi (y & # 39; _i-x & # 39; _i) ; ; ; text {for} x & # 39 ;, y & # 39; in (0.1) ^ d$$ in a computer program where $$psi (x): = sum_ {k in mathbb Z} phi (x + k) ; ; ; text {for} x in mathbb R$$ and $$phi (x): = frac1 { sqrt {2 pi sigma ^ 2}} e ^ {- frac {x ^ 2} {2 sigma ^ 2}} ; ; ; Text {for} x in mathbb R.$$

How am I supposed to do this so that I don't suffer from floating point inaccuracies?

A typical choice would be $$beta = 0.3$$ and $$sigma = 0.01$$. For this choice of $$sigma$$, the $$k$$th summand in the definition $$psi (x)$$, to the $$x in (-1.1)$$is extremely small though $$| k | ge2$$. Is there a cleaver method to calculate the product in the definition of? $$u & # 39; (x & # 39 ;, y & # 39;)$$?

Posted on Categories Articles

## I have to solve the differential equation numerically I have to solve this equation and draw the solution over time

Posted on Categories Articles

## na.numeric analysis – Solve a specific saddle point problem numerically

To let $$( Omega, mathcal E, mu)$$ be a probability space, $$k in mathbb N$$. $$W: = left {w: E to (0, infty) ^ k: sum_ {i = 1} ^ kw_i = 1 ; mu text {- almost certainly} right },$$ $$G$$ be a finite not empty set and $$a ^ {(g)}: E bis (0, infty) ^ k$$ His $$mathcal E$$– measurable for $$g in G$$,

How can we solve the saddle point problem? $$inf_ {w in W} sup_ {g in G} sum_ {i in I} int ^ {(g)} _ iw_i : { rm d} mu tag1$$ (at least numerically)?

Note that $$W$$ is a closed, convex subset of $$mathcal L ^ r ( mu; mathbb R ^ k)$$, with empty interior, contained in the unit closed sphere for everyone $$r ge1$$,

Note that for fixed $$g in G$$, a minimizer $$w in W$$ of $$sum_ {i in I} int a ^ {(g)} _ iw_i : { rm d} mu$$ is given by $$w ^ {(g)} _ i (x): = delta_ {ij ^ {(g)} (x)} ; ; ; text {for} x in E text {and} i in {1, ldots, k },$$ Where $$Delta$$ denotes the Kronecker Delta and $$j ^ {(g)} (x): = min underset {i in I} { operatorname {arg : min}} : a ^ {(g)} _ i (x) ; ; ; text {for} x in E$$ ($$operatorname {arg : min}$$ is treated as a fixed value and we break the bond by choosing the smallest index).

annotation: I'm not really interested in that $$G$$Component of a saddle point, d. H. I'm actually interested in a minimizer $$w in W$$ of $$sup_ {g in G} sum_ {i in I} int a ^ {(g)} _ iw_i : { rm d} mu$$,

Posted on Categories Articles

## Scripting – How can the following integral be numerically integrated in Fortran?

$$int_ {0} ^ { infty} x J_0 (cx) K_v (ax) / K_v (bx) dx$$
where a, b and c are positive real numbers and v is the order of the modified Bessel function of the second kind, which is positive.
I numerically evaluated this integral with Mathematica for a> b using the NIntegrate module with global adaptive method, but I want the values ​​of this integral in a Fortran program, so there is a way to get this Nintegrate subroutine from Mathematica out of one the fortran program.

Posted on Categories Articles

## magento2.3 – How to sort layered navigation elements alphabetically and numerically

In my layered navigation, I have articles that are sorted by quantity. For example, the items with the largest quantity are listed higher and the smaller quantity lower. What I'm looking for

category
A (2)
B (32)
C (1)

What's gotten right now

category
B (32)
A (2)
C (1)

I can't find where or how to change the sorting in alphabetical / numerical order.

Posted on Categories Articles

## Calculus and Analysis – How is the derivative of the theta function numerically evaluated?

I come across this derivative, but Mathematica does not evaluate the following:

``````ClearAll[f, g];
a = 0.1;
b = 0.2;
t = Exp[I 2 Pi/3];
f[z_] := SiegelTheta[{{a}, {b}}, {{t}}, z]
g[z_] = D[f[z], z]
g[0.1] // N
``````

I am not sure if this derivation can actually be evaluated to a numeric value …

Posted on Categories Articles

## Matrix – dealing with small values ​​in numerically calculated determinants

I am working with a system that is sensitive to small changes in the parameters, and it seems that I have found a curiosity in calculating these determinants. Consider the following notebook that symbolically calculates the difference between a Cauchy determinant and its explicit expression, a duplicate product identity:

``````n = 6;
Det(
Table(1/(Subscript(x, i) - Subscript(x, j) + I*d), {i, 1, n}, {j,
1, n})) -
Together(Product((Product((Subscript(x, i) - Subscript(x, j)), {j,
DeleteCases(Range(n), i)}))/(Product((Subscript(x, i) -
Subscript(x, j) + I*d), {j, Range(n)})), {i,
Range(n)})) // Together
``````

You can play around with the notebook a little and find that it is rated zero in all choices $$n$$but it also follows directly from its definition, see for example the ProofWiki page: https://proofwiki.org/wiki/Value_of_Cauchy_Determinant
Grow $$n> 6$$ The symbolic evaluation takes a long time.

Let's now compare this result to how the numerical engine handles the determinant for a set of well-known numeric values ​​that I have given with high precision:

``````Somelist =
{-2.720429521438901098928887457847735522241570629309655445484283916176
2851837940076705878334133338566725504772583431141`100.,
-2.1762869678867061257578265435033373072727030096070169917520092110094
228494837112924794755972678068499183016803447888`100.,
-1.6321821274889427089589633603571634071752936323769030600813741286710
093197123150456847747128393080598451666282345473`100.,
-1.0881056381882468248736694126587211176263719380315468050953342313940
656254201764494579813582052330928809092412643948`100.,
-0.5440480812497221008752883613910229406568608353211528787790109625693
10795803293784018232821905419611175228355254093`100.,
-1.0390780919331931969396043409817169372055536635669576759794231919964
3790278326743884776396234684571109165476054881`100.*^-118,
0.54404808124972210087528836139102294065686083532115287877901096256
9310795803293784018232821905419611175228355254093`100.,
1.08810563818824682487366941265872111762637193803154680509533423139
40656254201764494579813582052330928809092412643948`100.,
1.63218212748894270895896336035716340717529363237690306008137412867
10093197123150456847747128393080598451666282345473`100.,
2.17628696788670612575782654350333730727270300960701699175200921100
94228494837112924794755972678068499183016803447888`100.,
2.72042952143890109892888745784773552224157062930965544548428391617
62851837940076705878334133338566725504772583431141`100.};
c = 40.;
(CapitalNu) = Length(Somelist);
CauchyDet(a_, b_, c_) :=
Det(Table(
1/(a((i)) - b((j)) + c), {i, Range((CapitalNu))}, {j,
Range((CapitalNu))}))

(* Using the short-hand *)
CauchyDet(Somelist, Somelist, I*c)

(* Difference between determinant and definition *)

Det(Table(
1/(Somelist((i)) - Somelist((j)) + I*c), {i,
Range((CapitalNu))}, {j, Range((CapitalNu))})) -
Product((Product((Somelist((i)) - Somelist((j))), {j,
DeleteCases(Range((CapitalNu)), i)}))/(Product((Somelist((i)) -
Somelist((j)) + I*c), {j, Range((CapitalNu))})), {i,
Range((CapitalNu))})

(* Alternative representation *)

Det(Table(
1/(Somelist((i)) - Somelist((j)) + I*c), {i,
Range((CapitalNu))}, {j, Range((CapitalNu))})) -
Product((Product((Somelist((i)) - Somelist((j))) (Somelist((j)) -
Somelist((i))), {j,
i + 1, (CapitalNu)}))/(Product((Somelist((i)) - Somelist((j)) +
I*c), {j, Range((CapitalNu))})), {i, Range((CapitalNu))})
``````

As you can see, the error between the determinant and its definition seems to correspond exactly to the definition itself. What can I do to get around this?

Posted on Categories Articles