# Tag Info

0

Making use of Cavalieri's principle, one obtains m[t_] := RegionMeasure[DiscretizeRegion[ImplicitRegion[ArcSin[x1] + ArcSin[x2] + ArcSin[x3] + ArcSin[t] - (3*Pi)/2 >= 0 && x1 >= 0 && x1 <= 1 && x2 >= 0 && x2 <= 1 && x3 >= 0 && x3 <= 1, {x1, x2, x3}]]] NIntegrate[Evaluate[m[t]], {t, 0, 1}...

6

Clear["Global*"] Using If vol1 = NIntegrate[ If[ArcSin[x1] + ArcSin[x2] + ArcSin[x3] + ArcSin[x4] > 3 Pi/2, 1, 0], {x4, 0, 1}, {x3, 0, 1}, {x2, 0, 1}, {x1, 0, 1}, MinRecursion -> 9, WorkingPrecision -> 20, Method -> {"AdaptiveQuasiMonteCarlo", "RandomSeed" -> 1234}] (* 0.00076851819200000000000 *) Using Boole vol2 = ...

0

First, Mathematica really can't handle matrix (and vector) variables inside NDSolve. At least version 9. Second, while this solution works in version 9, Mathematica 8 says "NDSolve::underdet". Seems to be a bug which has been fixed. Third, it appears that you can take an element of a matrix inside NDSolve, if you enclose it inside Block. So I: 1) ...

3

We use Knopt[t] instead of K[t] (K is a system symbol) and initial data p[x, 0] == Cos[Pi x/20], q[x, 0] == 0 instead of c7 = p[x, t] == 0 /. t -> Tv; c10 = q[x, t] == 0 /. t -> Tv. Then the numerical solution converges: Sopt[t_] := 0. - 90989.2 t + 1.39914*10^9 t^2 - 8.76585*10^12 t^3 + 2.99045*10^16 t^4 - 6.32825*10^19 t^5 + 9.0249*10^22 t^6 -...

3

Following Artes suggestion and adding an explicit precision request: u[x_?NumericQ, y_?NumericQ, a_?NumericQ] := NIntegrate[Cos[a Sin[z]] - BesselJ[0, a], {z, y, x}, PrecisionGoal -> 3, Method -> {Automatic, "SymbolicProcessing" -> False}] v[x_?NumericQ, y_?NumericQ, a_?NumericQ] := NIntegrate[Sin[a Sin[z]], {z, y, x}, PrecisionGoal -> ...

3

Update: Used the built-in "InterpolationPointSubdivision" method. Update 2: Memoization helps because the subdivision is at the same points (given by xcoords in the code below) every time. So in intNest2[], the call int1st2[xp, t] will initially be made at the same xp for each subinterval, unless the subinterval contains the singular point x. I say, "...

3

m = 1; ω = {10, 10, 10, 10, 10, 10, 10, 10, 10, 10}; Convert γ to exact values to avoid forcing machine precision calculations γ = {0.1202, 0.1413, 0.1862, 0.2399, 0.3090, 1.0000, 1.5849, 1.9055, 1.9953, 2.5704} // Rationalize; f0[k_, y_] := PDF[ChiSquareDistribution[ω[[k]]], y] f00[k_, z_] := Gamma[ω[[k]]/2, 0, z/2]/Gamma[ω[[k]]/2] f1[k_, y_] := ...

1

Edit: I've changed this from an extended comment to an answer. The title concerns estimating the difference between two $\chi^2$ distribution functions. The text has the appearance of not directly addressing that question because of the large amount of code that doesn't explicitly mention a distribution function (at least in my opinion). A brute force ...

1

Your integral can be computed in analytic form. No need for numerics. Then you can tabulated it very easy. Notice that the following definition g[1]=53.62; g[2]=3.04; g[3]=2.54; fp[x_]:=g[1] Cos[(7π)/9 x]^4 + g[2] Sin[(7π)/9 x]^4+ g[3] Sin[(7π)/9 2 x]^2; is equivalent to your function. I just saw an identical idea in the comments section. All credits to ...

2

For some weird reason that I cannot understand at the moment, this one gets rid of the error messages and is this faster. amat = SymmetrizedArray[{m_, p_} :> Plus[ NIntegrate[ f[x] Sin[(m \[Pi] (x + 0.5 a))/a] Sin[(p \[Pi] (x + 0.5 a))/ a], {x, -a/2, 0}, Method -> {"GaussKronrodRule", "Points" -> 7}], NIntegrate[ ...

2

Here is a symmetric array example that will reduce the total integration time. For simplicity this example is based on the $f(x)$ in your original post. Clear[f, amat, m, p] f[x] = 53.62 Cos[(7 π Sqrt[x^2])/9]^4 + 3.04 Sin[(7 π Sqrt[x^2])/9]^4 + 2.54 Sin[(14 π Sqrt[x^2])/9]^2; nL = 20; amat = SymmetrizedArray[{m_, p_} :> NIntegrate[f[x] ...

0

Needs["NDSolveFEM"]; G = 6.894745 10^9; E1 = 26.25 G; E2 = 1.49 G; G12 = 1.04 G; nu12 = 0.28; nu21 = (E2*nu12)/E1; t = 0.0050 .0254; a = 1; b = 1; u0 = .01; Son = {{1/E1, -nu12/E1, 0}, {-nu21/E2, 1/E2, 0}, {0, 0, 1/G12}}; Qon = Inverse[Son]; Do[ Do[ angles = {{angle0, angle1}, {-angle0, -angle1}, {angle0, angle1}, {-angle0, -angle1}, {angle0, ...

5

Order of definition matters, oddly enough. If you switch the order of definitions, things will work OK. I always define the specific cases first, then the general. ψ0[x_] := 1/(2 π)^(1/4) Exp[-(x^2/4) - I k x]; ψr[x_, 0] := ψ0[x]; ψr[x_?NumericQ, n_?NumericQ] := ψr[x, n] = NIntegrate[SK[y, x, Δt] (Projector[x]/ Sqrt[NIntegrate[Abs[Projector[x] ψr[x, n -...

5

Just change the function definition to SetDelayed f[x_?NumericQ] := NIntegrate[Sin[x t^2]/Log[t], {t, 2, 3}] FindRoot[f[x], {x, 6.7}] (*{x -> 6.74481}*)

1

Try this f = Interpolation[ Table[{x, NIntegrate[Sin[x t^2]/Log[t], {t, 2, 3}]}, {x, 6.6, 6.8, 0.05}]] and then the following: FindRoot[f[x] == 0, {x, 6.8}] (* {x -> 6.7448} *) Have fun!

1

I would like to share some new findings to this post after nearly 2 years. As described in the question, running the original code gives me the NDSolve::mconly error. li = Import["http://rredc.nrel.gov/solar/old_data/nsrdb/1991-2005/data/tmy3/725958TYA.CSV"]; tae = Interpolation[Transpose[{Range[8760], Drop[Drop[li, 1][[All, 32]], 1]}]] Cwirk = 50 25 3; ...

0

<<k>> means that k elements have not been shown in the expression. The documentation for Short says : Short[expr] gives a "skeleton form" of expr, with omitted sequences of k elements indicated by <<k>>.

1

Simply define a function with SetDelayed: int[LL_] := NIntegrate[(v - 1)/(v + 1)*Evaluate[P[LL, v] /. s], {v, 1, 1000}, Method -> {"GlobalAdaptive", "SymbolicProcessing" -> 0, "MaxErrorIncreases" -> 10000, "SingularityHandler" -> "IMT"}, MaxRecursion -> 100, PrecisionGoal -> 4] Note however that you provide only one BC for a second-...

2

The following is quite fast on packed arrays: (Rest@Last@# + Most@Last@#).(Rest@First@# - Most@First@#)/2 &@ Transpose[t] Small example: t = DeveloperToPackedArray@ Table[{x, Sin[x]}, {x, Subdivide[0., Pi, 100]}]; Differences[#1].MovingAverage[#2, 2] & @@ Transpose[t] // RepeatedTiming 1/2 Total[Differences[t[[All, 1]]] ListCorrelate[{1,...

0

EDIT This approach doesn't work, as the method of choosing points to include in the polygon (counting crossings of rays extending from point) results in points sometimes in, sometimes out. With enough points, you are guaranteed for it to fail. Keeping this answer as it has useful info, and to head off any future ventures down this path. This is easy to ...

2

One could also go with a fully analytical approach: l1 = {1, 2, 4, 3, 1}; l2 = {3, 6, 5, 1, 0}; s1 = Subsequences[l1, {2}]; s2 = Subsequences[l2, {2}]; s = Transpose[{s1, s2}]; Edit: to avoid the code breaking when a polygon has area = 0, one can replace s with: s = Select[Transpose[{s1, s2}], #[[1]] != #[[2]] &] To speed up computation, one might ...

6

First of all, I observed that your matrix can be represented as KroneckerProduct of smaller matrixes which are themselfes KroneckerProduct (or TensorProducts) of vectors: Ux = Table[m^2 Sin[m x], {m, 1, k}]; Vx = Table[p^2 Sin[p x], {p, 1, k}]; Uy = Table[Sin[n y], {n, 1, k}]; Vy = Table[Sin[q y], {q, 1, k}]; Ax = KroneckerProduct[Ux, Vx]; Ay = ...

1

In fact, you can compute the exact answer for this case if you explicitly assemble the piecewise linear function representing the two "connect-the-dots" plots in the OP, and then feed the integrand to Integrate[]. Here's one way to derive the required piecewise linear interpolant: makePW[ya_?VectorQ, t_] := Piecewise[MapIndexed[{InterpolatingPolynomial[...

9

You can extract the polygons in llp using Cases: llp = ListLinePlot[{{1, 2, 4, 3, 1}, {3, 6, 5, 1, 0}}, Filling -> {1 -> {2}}]; polygons = Cases[Normal@llp, _Polygon, All] {Polygon[{{1.,1.},{2.,2.},{3.,4.},{3.33333,3.66667},{3.33333,3.66667},{3.,5.},{2.,6.},{1.,3.}}], Polygon[{{3.33333,3.66667},{4.,1.},{5.,0.},{5.,1.},{4.,3.},{3.33333,3.66667}...

2

Not an answer but some analysis : Some definitions to keep things easy to read: exp1 = Log[Abs[(a - b) (a - c) (b - c) (a - 1) (b - 1) (c - 1)]]; exp2 = Log[Abs[a - b]] + Log[Abs[a - c]] + Log[Abs[b - c]] + Log[Abs[a - 1]] + Log[Abs[b - 1]] + Log[Abs[c - 1]]; exp3 = Log[Abs[a b c]]; exp4 = Log[Abs[a]] + Log[Abs[b]] + Log[Abs[c]]; const = 1/ 2 (-...

0

I am not quite sure that I correctly understand what are you after. I think you want this: results =Table[{r,1/norm*NIntegrate[chi[1675.58, q, 5, 0.0004489, 7.6, 8.19*10^(-11)]*SphericalBesselJ[0, q*r]*q^2, {q, 0.001, 100},Method -> {"GlobalAdaptive", Method -> "GaussKronrodRule"}, PrecisionGoal -> 4]}, {r, 0, 30}]. As a minor correction, "...

2

There is no need to use NIntegrate: X = NDSolveValue[{x''[t] + 2 x'[t] + x[t] == 0, x[0] == 1,x'[0] == -4}, x, {t, 0, 2}] Plot[Integrate[Exp[y X[t]], {y, 1, 10}],{t,0,2}]

0

Clear["Global`*"] eqns = {x''[t] + 2 x'[t] + x[t] == 0, x[0] == 1, x'[0] == -4}; In defining f use Set rather than SetDelayed f = NDSolve[eqns, x, {t, 0, 2}][[1]] g[t_?NumericQ] := NIntegrate[Exp[y*x[t] /. f], {y, 1, 10}] For comparison, the exact solution of the differential equation is sol = DSolve[eqns, x, t][[1]] (* {x -> Function[{t}, -E^-t (-...

2

A useful piece of advice. Before putting many commands in the same cell, try to run each one individually to make sure that there are no errors. This time it was the first NDSolve causing something. The following code works f1 = NDSolve[{x''[t] + 2 x'[t] + x[t] == 0, x[0] == 1, x'[0] == -4}, x, {t, 0, 2}] Plot[x[t] /. f1, {t, 0, 2}] And then,the ...

3

The approach taken in this answer is also applicable to this problem. Construct the function to be integrated: derPhi = Head[Simplify[D[WaveletPhi[DaubechiesWavelet[8], x], x], 0 < x < 15]] Verify that we have a piecewise linear interpolant: derPhi["InterpolationOrder"] {1} This means, we can use a low-order quadrature rule to evaluate (sub-)...

Top 50 recent answers are included