# Tag Info

15

Here's my attempt. To get the matrix representing the Laplacian I use LaplacianFilter on an array of symbols and CoefficientArrays to extract the coefficients. n = 200; shape = ArrayPad[ConstantArray[0, {n/2, n/2}], {{0, n/2}, {0, n/2}}, 1]; shapeVector = Flatten @ Position[Flatten @ shape, 1]; symbolArray = Array[x, {n, n}]; symbolLaplacian = ...

12

While the other answers are nice, the icon deserves a closer look: Note, in particular, that four of the six edges are not constrained by the ostensible Dirichlet boundary conditions, nor is it clear that they solve a Neumann problem. And indeed, as I noted in the comments this is supported by the OP's first link. In short, to produce the logo, they took ...

11

I had this laying around from a course in numerical linear algebra I taught a few years ago. Here's a matrix whose nonzero elements describe the basic shape. size = 50; nw = Partition[Table[i, {i, 1, size^2}], size]; sw = Partition[Table[i, {i, size^2 + 1, 2*size^2}], size]; se = Partition[Table[i, {i, 2*size^2 + 1, 3*size^2}], size]; L = ...

10

The answer is no because of fundamental mathematical limitations which origin in the set theory regarding countability (see e.g. Cantor's theorem) - functions over a given set are more numerous than its (power) cardinality. Neither Mathematica nor any other system can integrate every function in even much more restricted class, namely Riemann integrable ...

6

Using the functions defined in my answer to your previous question here you have the intersections with all three coordinate planes: getOneCluster[pts_List, maxDist_?NumericQ] :=(*Returns a cluster*) Module[{f}, f = Nearest[pts]; FixedPoint[Union@Flatten[f[#, {Infinity, maxDist}] & /@ #, 1] &, {First@pts}]] clusters[data_] := Module[{f, ...

5

You have to be able to reduce the integrand to a sum of terms in which the symbolic constants are factors of the term. Then you can separate the terms and their factors. Gather the factors that are constants, and numerically integrate the (product of the) function-factors of each term. expr = 11.94 a[1, 1]^2 Cos[x]^2 Cos[θ]^2 + 21.31 c[1, 1]^2 ...

4

Every integral over a function behaving asymptotically (when $x$ goes to infinity) as $\frac{1}{x^\alpha}$ where $\alpha \leq1$ is divergent, it's a mathematical theorem which could be found in every reasonable handbook of calculus. Since Tanh[ π Sqrt[x]] goes to one rapidly we find that the integral is indeed divergent. We can demonstrate this fact with ...

4

I believe your code is not working as you are not incrementing your iterator t. I present the following (using FoldList) as alternative iterative approach. euler2d[f_, g_, h_, t0_, f0_, g0_, n_] := FoldList[#1 + h {f[#2, First@#1, Last@#1], g[#2, First@#1, Last@#1]} &, {f0, g0}, Range[t0, t0 + n h , h]] Note in this case the interval of ...

4

I suspect you want the principal value, since the integral is divergent. Integrate[ z Exp[I z r]/Sqrt[z^2 + m^2], {z, -∞, ∞}, PrincipalValue -> True, Assumptions -> m > 0 && r ∈ Reals] (* 2 I m BesselK[1, m Abs[r]] Sign[r] *) If r > 0, then it agrees with your expected answer. Another derivation, although it seems more ...

3

Use Mesh and MeshFunctions: gr1 = ParametricPlot3D[ Evaluate[{x[t], y[t], p2[t]} /. sol2], {t, 0, tfin}, PlotPoints -> 4000, MeshFunctions -> {#1 &}, Mesh -> {{0}}, MeshStyle -> {Directive[PointSize[Medium], Red]}, BoxRatios -> {1, 1, 1}, ViewPoint -> {1, 0, -2}, DisplayFunction -> Identity]

3

You can do the whole thing analytically: (*ϵ=78.36; λ=0.548881;*) Clear[ϵ, λ]; funcin = 1/(ϵ * π) * Exp[-(2*r + λ * Sqrt[r^2 + ρ^2 - 2*r*ρ * Cos[θ]])] * r^2 * Sin[θ] * 1 / Sqrt[ρ^2 + r^2 - 2*r*ρ * Cos[θ]]; intfuncinang = Assuming[r > 0 && ρ > 0 && ϵ > 0 && λ > 0, Integrate[funcin, {θ, 0, π}, {ϕ, 0, 2 π}] ] (* ...

3

fnintegrate[ exp_ , lim__ ] := Module[{f, vars}, vars = #[[1]] & /@ List[lim]; Distribute[f[exp]] //. f[a_ b_ /; And @@ ((D[a, #] == 0) & /@ vars) ] :> a f[b] /. f[y_] :> NIntegrate[y, lim] ] fnintegrate[ 11.94` a[1, 1]^2 Cos[x]^2 Cos[θ]^2 + (etc ) , {θ, 0, 2}, {x, 0, 1}] ...

3

iMass = 4; iVel0 = {1.0, 1.0, 1.0}; iTime = 1.0; iMagn = Dot[iPos[time], iPos[time]]^0.5; iForce = ((12.3/iMagn) - 1.2)*Normalize[iPos[time]]; iAccel = iForce/iMass; iPos0 = {0.0, 10000, 0.0}; sol = NDSolve[ {iPos''[time] == iAccel, iPos'[iTime] == iVel0, iPos[iTime] == iPos0}, iPos, {time, iTime, 10}] ParametricPlot3D[Evaluate[iPos[time] /. sol], ...

2

That means the boundary conditions defined should fit the the range of t and r in NDSolve command. You have 4 values: {t,0,10} and {r,0,100}, so you have to define the conditions at these 4 values. Here you define at r = s = 1 but you run r from 0 to 100. You need to define the boundary condition at r = 0 and at r = 100. But I don't know which boundary ...

2

Let's start with the simplest problem. You ask for NIntegrate[NIntegrate[y, {x, 0, 1}], {y, 0, 1}]. This doesn't work because when the internal integral is being evaluated, y doesn't have any values (hence the error). A simple way to fix this is to do the double integral rather than trying to do two single integrals. Hence: NIntegrate[y, {x, 0, 1}, {y, 0, ...

2

Humm... This integral is zero. So the answer to your question is zero for any x, y $$\frac{1}{(x \cos(\theta)+y \sin(\theta))^\frac{5}{2}}$$ Clear[theta, x, y]; f = 1/(x Cos[theta] + y Sin[theta])^(5/2); int = Integrate[f, theta]; int /. theta -> 2 Pi int /. theta -> 0 (int /. theta -> 2 Pi) - (int /. theta -> 0) (* 0 *) Update ...

2

Give this a whirl: ifun = Interpolation[{{0, 0}, {1, 1}, {2, 3}, {3, 4}, {4, 3}, {5, 0}}]; out1 = NIntegrate[x*ifun[x], {x, 0, 5}]; xifun = FunctionInterpolation[x*ifun[x], {x, 0, 5, .01}]; out2 = Integrate[xifun[x], {x, 0, 5}]; Row[{out1, N[out2]}, " "] (* 32.5694 32.5694 *)

1

In lieu of a working example in the current OP to work with, yes, this can be done. An example of two bouncing balls with differing velocity retention on bounce: eventtab = Table[With[{n = n}, WhenEvent[y[n][t] == 0, y[n]'[t] -> (-0.95 + n/100) y[n]'[t]]], {n, 2}] NDSolve[{y[1]''[t] == -9.81, y[1][0] == 5, y[1]'[0] == 0, y[2]''[t] == -4, ...

1

As it is already mentioned in the comments, the initial condition Derivative[1, 0][u][0.001, x] == 0, should not appear there. After it removal the equation is solved as expected: eps4 = 0; phi6m4V = NDSolveValue[{D[u[t, x], x, x] - D[u[t, x], t]/ Sqrt[t^2 + x^2] == -6 u[t, x]^5 + (8 + 4 eps4) u[t, x]^3 - (2 + 4 eps4) u[t, x], ...

1

You can do the integrals over the angular variables analytically; the result will be a function of r, ρ : intth = 2 Pi Integrate[funcin, θ]; integ[ρ_] = (intth /. θ -> Pi) - (intth /. θ -> 0) ; output = Table[{ρ, NIntegrate[integ[ρ], {r, 0, Infinity}]}, {ρ, 0.1, 3,0.05}] ; ListLinePlot[output]

1

getOneCluster[pts_List, maxDist_?NumericQ] :=(*Returns a cluster*) Module[{f}, f = Nearest[pts]; FixedPoint[Union@Flatten[f[#, {Infinity, maxDist}] & /@ #, 1] &, {First@pts}]] clusters[data_] := Module[{f, dist},(*Some Characteristic Distance, assuming no isolated points*) f = Nearest[data]; dist = 3 Max[EuclideanDistance[Last@f[#, 2], #] ...

1

You are almost there. Just make a function from the code you wrote for a single time value: energyTotale[t_?NumericQ] := Module[{phi62, energiephi6}, phi62 = phi6m[t, x]; energiephi6 = D[phi62, x]^2 + (phi62^2 - 1)^2 (phi62^2 - 0.625); NIntegrate[energiephi6, {x, -7, 7}] ] You can now in principle use that as a function to be plotted. You can not ...

1

As I mentioned in my comment, the easiest way to integrate a list of values is to use Interpolation with Integrate or NIntegrate. As Jens noted, the upgrade information for ListIntegrate, an obsolete function also mentions the same thing. For the sake of completeness, here's how you'd do it: With[{if = Interpolation[(* list of {x, y} pairs *), ...

1

To respond to the comment-question of sebhofer: The internal integral is calculated analytically to the end: Integrate[Exp[-(y - \[Mu])^2/(2*\[Sigma]^2)], {y, x, \[Infinity]}, Assumptions -> {\[Sigma] > 0, \[Mu] > 0}] (* Sqrt[\[Pi]/2] \[Sigma] Erfc[(x - \[Mu])/(Sqrt[2] \[Sigma])] *) Introducing the new variables: x=sigma*ksi and mu=sigma*m ...

1

Lets consider some parameters: \[Sigma] = 1; \[Mu] = 1; n = 10; k = 4; I think n should be greater than k for your case. NIntegrate[((1/(Sqrt[2*Pi]*\[Sigma]))*Exp[-(x^2/(2*\[Sigma]^2))])* NIntegrate[((1/(Sqrt[2*Pi]*\[Sigma]))* Exp[-((y - \[Mu])^2/(2*\[Sigma]^2))]), {y, x, Infinity}]^(n - k), {x, -Infinity, Infinity}]^k It gives 0.029438

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