mmal
• Member for 9 years, 7 months
• Last seen more than a month ago
• Vienna, Austria

264 views

You can use MapAt function to map function on specific part of the expression MapAt[f, {1 -&gt; 2, 2 -&gt; 3, 3 -&gt; 1}, {All, 2}] (* ==&gt; {1 -&gt; f[2], 2 -&gt; f[3], 3 -&gt; f[1]} *) or use ...

2k views

You should use the SolveAlways function, which will solve your equation for all values of the parameters (in this case for any t). So the solution to your question is SolveAlways[4 b*Cos[2 t] - 4 a*...

194 views

IntervalMemberQ[Interval[{-2, 6}], 3] (* =&gt; True *)

216 views

Actualy, for $a=1/5$ the solution converges. The convergence speed for relaxation process is sensitive to initial condition, and greately slows down near fixed point solution. Using default options ...

553 views

A brute force solution is to check all possible values of this function. num = {1/10, 1/2, 4/7, 3/5, 2/3}; pow = {0, 1, 2, 3, 4}; To obtain value for one combination use the Inner function Inner[...

236 views

This is clearly a bug in 10.0 up to 10.2. According to reply to my report [CASE:3484187] The issue has been resolved in version 10.3. Please upgrade. I hope this will be helpful to someone.

355 views

Try NestList[Integrate[#, x] &amp;, x, 2] // Rest // Accumulate to get the list of successive iterations or NestList[Integrate[#, x] &amp;, x, 2] // Rest // Total to obtain only the last element.

302 views

Try to define your matrix as a function of $(x,q,r,t)$ variables S[x_, q_, r_, t_] := {{1/r^2, 1, 1, t Sqrt[x]}, {1, 1/t^2, 1, Sqrt[x]/t}, {1, 1, 1, Sqrt[q]}, {t Sqrt[x], Sqrt[x]/t, Sqrt[q], 1}}; ...

439 views

Your theoretical arguments are correct. The reason for this spurious oscillations is the numerical error. If you increase error tolerance in NDSolve (note that default tolerance is $\sim 10^{-7}$) you ...

3k views

Let define the equation to solve $f=x-y\epsilon\sin(2 x)\equiv 0$ and series expansion of $y$ in powers of $\varepsilon$. f = x - y - \[Epsilon] Sin[2 y]; ord = 3; y = x + Sum[a[n] \[Epsilon]^n, {n, ...

1k views

You may start with something like that equ = {-y'[t] + 1 + (1 + \[Epsilon]) y[t]^2}; y[t_] := Sum[x[i][t] \[Epsilon]^i, {i, 0, 10}] // Evaluate; First order solution (use SeriesCoefficient function ...

169 views

Even if there is some kind of mistake (typo) the solution is to use WhenEvent with Sow and Reap: {sol, {pts}} = Reap@NDSolve[{x''[t] == x[t]/(2*Sqrt[x[t]^2 + (1 - y[t])^2]), y''[t] == -0.2 - ...

1k views

Solution by @Kuba can be easily extended to put the oscillators on a circle. Loin = NDSolve[Stew, Table[x[i], {i, 0, 10}], {t, 50}]; fr[t_] = Transpose@{Most@Range[0, 2 Pi, 2 Pi/11], x[#][t]&amp;/@...

648 views

The problem in your question is not about accuracy of $\text{sinc}(x)$ function itself but with the precision of FindRoot. When you increase working precision of the calculations (by using ...

140 views

For better presentation I've decreased size of matrices to 4. n = 4; MatrixForm[m = Array[Subscript[a, ##] &amp;, {n, n}]] With[{ij = {RandomInteger[{1, n}], RandomInteger[{1, n}]}}, ReplacePart[m,...

430 views

You should have a look at ColorFunctionScaling option. When set to False in your case it gives Show[ DensityPlot[x^2 + y^2, {x, 0, 1}, {y, -1, 1}, PlotRange -&gt; {0, 2}, ...

77 views

Use one of the following a &lt;&gt; "0" /. {a -&gt; "1"} // Quiet or ReleaseHold[Hold[a &lt;&gt; "0"] /. {a -&gt; "1"}]

572 views

You can use Piecewise function in the definition of DE. So for system at hand the NDSolve command would be xyz = First@ NDSolve[{x''[t] == -2.25 Cos[1.5 t] - x[t] - x'[t], x[0] == 0, x'[0] == ...

2k views

First, I would suggest simplifying your equation. For this I've converted all constants to exact numbers q1 = 1; q2 = 1/2; e1 = 1; e2 = 8/10; s1 = 1; s2 = 6/10; γ = 1000; m1 = Sqrt[ζ^2 - I*w/s1]; m2 =...

432 views

You can not assign to a list in local variable specification as You did {x1,x2,sd1}=measure. You can assign specific parts of dummy variables: AntennaPower[measure_, antenna_] := Module[{x1=measure[...

473 views

I would recommend to code intermediate steps as separate functions, e.g. solve[a_?NumericQ] := z /. First@ NDSolve[{x'[t] == (x[t]*a*(x[t] + y[t] + z[t]))/(a*x[t] + 2.13*y[t] + 2.34*z[t]) - x[t],...

470 views

Forcing large enough constant step size (in time) for NDSolve method lead to instabilitity. sol = NDSolve[{D[u[t, x], t] == 0.5 D[u[t, x], x, x] + u[t, x] D[u[t, x], x], u[t, -Pi] == u[t, Pi] == ...

227 views

You need to replace function u with your definition, not only the u[x] symbol. Defining u as a function solves the problem Solve[u[x] == u[a] + u[b], x] /. {u -&gt; Function[x, x]} (* ==&gt; {{x -&...

194 views

You can use the pattern matching as @Sjoerd C. de Vries suggested, eg. Cases[data, {d_, v_} :&gt; {d[[1 ;; 3]], v}] or Cases[data, {{y_, m_, d_, ___}, v_} :&gt; {{y, m, d}, v}] Alternately you can ...

314 views

I would suggest (as an alternative) the following pointsAndValues[x_InterpolatingFunction] := Transpose[{First[x["Coordinates"]], x["ValuesOnGrid"]}]; ListPlot[ pointsAndValues@ First@...

759 views

Maybe the solution would be to forget about NIntegrate and to try to do it 'by hand', e.g. integrate[f_, nx_, prec_: MachinePrecision] := Module[{xg, fg}, xg = Table[(2 i - 1)/(2*nx) \[Pi], {i, 1, ...

3k views

Just extract second argument from Rule function by Solve[p == 2 t + 1, t][[1, All, 2]] Use All in case of more then one solution.

3k views

What about the following: F[x_, y_] := Sin[Sin[x - y]] + I Cos[Cos[x + y]]; With[{x = a - 3 I}, ContourPlot[{Re[F[x, y]] == 0, Im[F[x, y]] == 0}, {a, -1, 1}, {y, -3/2, 3/2}, FrameLabel -&gt; (...

234 views