# Tag Info

16

I would approach this from the fact that both are forms of multiplication, but one has a negative exponent. So RandomReal[{1, 20}]^RandomChoice[{1, -1}] will randomly be either 1/x or x, where x is a random number between 1 and 20.

6

The solution is a straightforward application of Integrate. Integrate[Exp[-((x - x0)^2 + (y - y0)^2)/(2 c) - I (kx x + ky y)], {x, -Infinity, Infinity}, {y, -Infinity, Infinity}, Assumptions -> c > 0] (* 2 c E^(-(1/2) c (kx^2 + ky^2) - I (kx x0 + ky y0)) π *)

5

What about computing a general $t$-bound integral: expr = Integrate[Exp[-2 ((x + y)/2 - b)^2/(2*a)], {x, -t, t}, {y, -t, t}]; And then expanding in series around $t=\infty$: Series[expr, {t, Infinity, 3}] // Normal // PowerExpand // FullSimplify $\frac{a^2 \left(e^{-\frac{(b-t)^2}{a}}+e^{-\frac{(b+t)^2}{a}}\right)}{t^2}-4 a e^{-\frac{b^2}{a}}-4 ... 5 Examine your integrand (which is suggested by the error, after all). PiecewiseExpand will collect all terms under one piecewise function. c*h[c, k1, t1]*(1 - H[c, k2, t2])*(1 - H[c, k3, t3]) // PiecewiseExpand (* Power::infy, Infinity::indet errors... *) You can see that the function does not have numeric values for c > 1. How to fix it is ... 5 Depending on the distribution desired, you could use the log-normal (or a similar transformation of whatever distribution has a mean of 0). It is transformed distribution such that a value -y < 0 of the underlying distribution is transformed to 1/x iff the value y > 0 is transformed to x (i.e., Exp[-y] == 1/x where x = Exp[y]). The "underlying" ... 5 linearizeEquation[expr_, f_, fp_, order_] := Block[{e}, Expand@Normal@Series[expr /. f -> (fp + e dF[#] &), {e, 0, order}] /. e -> 1 ] linearizeEquation[f[x] + (1 - f[x]^2) + D[f[x], {x, 2}] + f[x] D[f[x], x], f, f0, 1] (* 1 + f0 - f0^2 + dF[x] - 2 f0 dF[x] + f0 dF'[x] + dF''[x] *) 4 One way: RandomChoice[{Times[x, #] &, Divide[x, #] &}][RandomReal[{1, 20}]] To repeat, use a Table or Do expression, etc. 4 This was done in V10.3.1. Integrate[(-2 a Cos[π/24] Gamma[11/12] HypergeometricPFQ[{11/24, 23/24}, {2/3, 4/3}, (4 a^3)/27] + 8 Gamma[5/4] HypergeometricPFQ[{1/8, 5/8}, {1/3, 2/3}, (4 a^3)/27] Sin[π/8] + a^2 Gamma[19/12] HypergeometricPFQ[{19/24, 31/24}, {4/3, 5/3}, (4 a^3)/27] Sin[(5 π)/24]), {a, 0, ∞}] (864/665) Sqrt[2 (4 + ... 4 The problem occurs because of apparently complex form of the expression beyond the integral of Sin[s^k]. Nevertheless it is not too harmful to proceed. Adequate limits are real and we don't need playing to simplify complex expressions to explicitly real forms. We can calculate the both integrals with appropriate assumptions: f[x_, k_] = Integrate[{ ... 4 I would suggest adding option GenerateConditions->False to Integrate to speed up the integration. Then, instead of D, use Derivative. Then, to generate a SeriesData apply Series: f[x_] := 1/x; max = 4; em[n_Symbol] := Series[Integrate[f[x], {x, 1, n}, GenerateConditions -> False] + (f[1] + f[n])/2 + Sum[BernoulliB[2 k]/(2 k)! (Derivative[2 ... 4 Perhaps useful I think this substitution provides a preferable form for the numerical integration: exp = ((w E^(-w/a) Sin[((w - s)^2)/2])/((w - s)^2)/2 /. w -> -a Log[g]) D[-a Log[g], g] f[b_?NumericQ] := Block[{a = 10^-6, s = -10^(-1) Sqrt[10^(-3)^2 + b^2]}, - a^2 NIntegrate[exp/a^2, {g, 0, 1}, WorkingPrecision -> 30, ... 4 Evaluating the integral analytically seems to take far too long on my machine, so I aborted it. Since you mention that you studied the integrated expression, perhaps you could consider showing result you got from the integration in your question. Having said that, numerical integration suggests that the values of the integral are very small over a wide ... 4 Get the MNIST digit recognition data set (70,000 hand-drawn digits with classifications): totalSet = ExampleData[{"MachineLearning", "MNIST"}, "Data"]; Divide it into training set, validation set (used to find optimum values for hyperparameters, such as regularization constants) and test set (which is not used in building the classifier at all, but which ... 4 Integrate[Exp[-s x] Cosh[a x], {x, 0, ∞}, Assumptions -> s > Abs[a] && a ∈ Reals]$\frac{s}{s^2-a^2}$Note that this is the Laplace transform: LaplaceTransform[Cosh[a x], x, s]$\frac{s}{s^2-a^2}$Your problem was that you were trying to integrate a "function" that included the logical expression && when that was actually a ... 3 You want to hunt down the error? Here is the best piece of advice: don't plot a function until you know it works. Okay, that's out of the way, now let's go through the process of finding out why your code gives an error. First we can look at just one integral, Λ = 10^-6; Δ = 10^-3; θ = 1/2 ArcTan[Δ/δ]; h = 10^-1; t = 10^3; s = -h Sqrt[Δ^2 + δ^2] ... 3 I think you will have to ask a mathematician if the limit is really 0 (or even real) since in Mathematica you can get this s[x_] := Sqrt[ Pi^2/12 + Sum[(x!*x!)/(k!*(2 x - k)!)*(-1)^(x - k)/(x - k), {k, 0, x - 1}]] s[x] // FullSimplify Limit[s[x], x -> Infinity] // FullSimplify So the limit seems to be complex, but I am not sure, I am not a ... 3 I'm a little bit late to this party, but I had written this function for another question that turned out not to need it, so I'll put this here. My strategy is to straightforwardly calculate the integral via$\begin{align} \int f(\vec x) &\, \exp\left( - \frac 1 2 \sum_{i,j=1}^{n}A_{ij} x_i x_j \right) d^nx = \\ & \sqrt{(2\pi)^n\over \det A} \, ... 2 As @bbgodfrey commented, if the integrals in the equation in the OP's FindRoot command can be evaluated before passing the equation to FindRoot, one can save a lot of time. It seems there is still more to be done. I found FindRoot struggles to find an accurate root in some areas of the domain of the equation. It turns out one can use Solve to solve the ... 2 Λ = 10; Ω = 10; k[t_] := k[t] = NIntegrate[ω E^(-ω/Λ) Sin[(ω + Ω) t/2]^2/(ω + Ω)^2, {ω, 0, ∞}] Plot[k@t, {t, 0.01, 1}, MaxRecursion -> 1, PlotPoints -> 20] 2 You can accomplish something very similar to your pseudo-code by defining a function: rand := RandomChoice[{Times, Divide}] Now every time you call the rand function, it either multiplies or divides its two arguments. For example, rand[3, 4] returns 12 half the time and 3/4 the other half. Now you can replace the "4" with a randomly chosen number and ... 2 A "nice" result is confirmed, but it is not the one hoped for in the OP but that of george2079 and others here. An analysis is made on the basis of the fundamental theorem of calculus. Here no error messages appear but the slight uncertainty is now shifted to the hypothesis of continuity of the antiderivative. This in turn seems pretty obvious from plotting ... 2 Observing strictly that the domain of x as the upper limit of the summation index is the integers, the limit exists, it can be calculated easily with Mathematica and it is different from zero. We need to consider this sum \[Sigma]WH[x_] := Sqrt[\[Pi]^2/12 + Simplify[Sum[(x!*x!)/(k!*(2 x - k)!)*(-1)^(x - k)/(x - k), {k, 0, x - 1}], x \[Element] ... 2 In your inputs a = 10^-6; b = 10^-3; c = 1; d = 0.1; s = -d Sqrt[b^2 + c^2] -0.1 this result is approximated for display. You can see the complete result by placing your cursor in front of the -0.1 and pressing the space bar. Alternatively InputForm[s] -0.1000000499999875 Edit With s = -d Sqrt[b^2 + c^2] the integral calculation yields ... 2 The copyable code you omitted: res = Integrate[(1 - Exp[h *(s - T)])^4/(k2 - k1* Exp[(s - T)*(2 h)])^2, s, Assumptions -> Element[k1 | k2, Reals] && k1 < 0 && k2 < 0] You are surprised to see a term\sqrt{k1}\$ pop up in the answer, with k1 defined as being negative. You don't specify why you see that as a problem, so I have ...

2

Mathematica knows how to simplify when a is exactly 2*Pi: (-b*Cos[a*b] Sin[a/2] + Sin[a*b] Cos[a/2])/(b^2 - 1) /. a -> 2*Pi // InputForm -(Sin[2*b*Pi]/(-1 + b^2)) It then applies the numerical limit for b=1. For the approximate number 2.*Pi, Mathematica can't make this simplification, and it turns out the limit is +Infinity for a<2*Pi and ...

2

Some of the definitions in the original question were problematic. I edited the question to have more consistent code. In order to plot the function numerical values are needed, so using Integrate is not necessary. We can use NIntegrate instead. The plot is produced within 30 seconds on my laptop with Mathematica 10.3.1. Here is the function redefined: ...

2

This is more a long comment than an answer. If you calculate: D[x Hypergeometric2F1[1/2, 2/3, 3/2, x^2], x] FullSimplify@D[x/Sqrt[1 - x^2], x] You find respectively: 1/(1 - x^2)^(2/3) and 1/(1 - x^2)^(3/2) Mathematica gives the correct answer: Check the exponents!!

2

If you change the variables: y1=x1+x2; y2=x2 you get to another expression: where all the integration limits are +/- infinities. The first integral is just equal to infinity, while the second is Integrate[Exp[-(y1 - 2 b)^2/(4 a)], {y1, -\[Infinity], \[Infinity]}, Assumptions -> {a > 0, b > 0}] (* 2 Sqrt[a] Sqrt[\[Pi]] *) I hope this ...

1

If numerical results are acceptable; Needs["NumericalCalculus`"] func[θ1_,n_]:= 1/2 ((n Cos[θ1] - 0.2 Sqrt[1 - 25. n^2 Sin[θ1]^2])^2/(n Cos[θ1] + 0.2 Sqrt[1 - 25. n^2 Sin[θ1]^2])^2 + (-0.2 Cos[θ1] + n Sqrt[1 - 25. n^2 Sin[θ1]^2])^2/(0.2 Cos[θ1] + n Sqrt[1 - 25. n^2 Sin[θ1]^2])^2) int[n_?NumberQ] := int[n] = NIntegrate[func[\[Theta]1, n], ...

1

This is what I get on OS X 10.3.1 (64bit)

Only top voted, non community-wiki answers of a minimum length are eligible