Tag Info

Hot answers tagged

6

DSolve can handle this. Clear[y]; y[x_, e_] = y[x] /. DSolve[{ e y''[x] + y'[x] x == -e Pi^2 Cos[Pi x] - Pi x Sin[Pi x], y[-1] == -2, y[1] == 0}, y[x], x][[1]] // Simplify Manipulate[ Plot[y[x, e], {x, -1, 1}], {{e, 0.01}, 0.0001, 0.1, Appearance -> "Labeled"}]


6

Alternatively, this can be treated as a boundary-value problem. a = 1.1; b = 1.2; tf = 20; eqn = {x''[t] + (a + I*b)*x[t] == 0}; inits = {x[0] == 1, x[20] == 0}; sys = Join[eqn, inits]; sol = NDSolve[sys, x[t], {t, 0, tf}]; Plot[Evaluate[ReIm[x[t]] /. sol], {t, 0, tf}] MichaelE2's caveat applies here too, "It might be significantly more difficult in a ...


5

If you can define an objective function that measures the size of the solution, you could optimize it. This is simple to do on the simple test case. It's a linear system, so the convergence/divergence will depend only on the ratio x'[0]/x[0]. One can optimize varying x'[t] for x[0] == 1 and test x[0] == 0 separately (best to do x[0] first, but I omit the ...


4

As noted by @bbgodfrey, the "shooting" algorithms that Mathematica tends to use are not well-adapted to this particular equation. Better would be some kind of relaxation method, which is what Mathematica uses (I think) for solving PDEs on a mesh. And an ODE is just a PDE in one dimension, so let's try solving this equation on a one-dimensional mesh: ...


4

To see why NDSolve has difficulty with this problem for very small e, consider that NDSolve solves this two-point boundary value problem by some form of shooting. In other words, it varies y'[min] until one is found that yields the desired y[max]. However, as e becomes very small, the sensitivity of y[max] to y'[min] becomes great, because the differential ...


3

Replace ,DirichletCondition[cA[t, r, z] == 0, True] ,DirichletCondition[cB[t, r, z] == 0, True] ,DirichletCondition[cC[t, r, z] == 0, True] by , DirichletCondition[cA[t, r, z] == 0, z == z1 || z == z2] , DirichletCondition[cB[t, r, z] == 0, z == z1 || z == z2] , DirichletCondition[cC[t, r, z] == 0, z == z1 || z == z2] , DirichletCondition[cA[t, r, z] == ...


2

And we Go: ClearAll[b, c, k, x, t T0]; SOL = First @ Assuming[{b, c, k, T0} ∈ Reals, DSolve[{x'[t] == b x[t] - (c - x[t])^2/(4 k), x[T0] == 0}, x[t], t]]; // Quiet FullSimplify[SOL] $\left\{x(t)\to 2 \sqrt{b} \sqrt{k} \sqrt{b k+c} \tanh \left(\frac{\sqrt{b} (t-\text{T0}) \sqrt{b k+c}}{2 \sqrt{k}}-\tanh ^{-1}\left(\frac{2 b k+c}{2 ...


2

[Edit: Rewrote and expanded explanation of how to set up DSolve and why it fails.] You were almost there.... First, I want to show how such a problem should be specified, if you want DSolve to handle it all for you. DSolve can do it, provided such a system is solvable by Mathematica to begin with. Understanding how DSolve works with such equations helps ...


2

Since you are specifically asking about versions below 10, it may be useful to point out that this problem is equivalent to the electrostatics problem of finding the potential in a region bounded by conductors held at fixed voltages. This can be solved, e.g., with the simple relaxation method I implemented in this answer, where I actually allow for lots of ...


2

This is the outline of an answer. To begin, assume that R u v is meant instead of Ruv. As noted by MarcoB, attempting to solve the equations by brute force, as suggested in the Question, takes forever. Instead, first simplify the three linear ODEs by adding constants to the dependent variables. eq = {x'[t] == R x[t] v + R y[t] u + R u v - x[t] - u, ...


2

I rewrote your code and it works for me so I suspect there is a bug in your code. Some tips: when you write out the equation as you have done it is very easy to make mistakes. What I recomment is that you define $P=\{P_1,P_2,P_3\}$ and $Q=\{Q_1,Q_2,Q_3\}$ only once (instead of retyping it every time you need it) and then write the equation directly in ...


1

No, your Fao[ ] doesn't work as posted. Ro = .007; Caorta = 1/.48; k = 110; ω = 2 π; x = 1000000; Rsystemic = 3.1; Vo = 108; Cheart = 6.67; m[ω_, t_] := 1/2*k*(1 + Cos[ω t]) + 10 PaoMwt[ω_, t_] := m[ω, t] - Paorta[t] pw[fun_] := Piecewise[{{Ro, fun > 0}}, x*Ro] VhMwt[ω_, t_] := m[ω, t] - ((Vheart[t] - Vo)*m[ω, t] + Vheart[t]/Cheart) sol = ...


1

Solving this problem is probably going to get you in to the deep weeds of Method specifications in NDSolve. When Mathematica encounters the code as originally stated, it defaults to a finite element method. The problem is that Mathematica's finite element methods can't handle equations with higher than second-order derivatives in the spatial variables, ...


1

Although this Answer does not use Floquet analysis, it does cast the equations into a more useful form and provide a sample numerical solution. X[t] = {{x1[t], x2[t]}}\[Transpose]; b[t] = b1 E^(-I δ t) + b2 E^(I δ t); a[t] = a1 E^(-I δ t) + a2 E^(I δ t); M[t] = {{0, FullSimplify[Conjugate[b[t]], t ∈ Reals && δ ∈ Reals && b1 ∈ ...


1

I can reproduce this behavior like this: y' = y^2; s = NDSolve[{y'[x] == y[x], y[0] == 1}, y, {x, 0, 1}] NDSolve::dvnoarg: The function y appears with no arguments. >> (* NDSolve[{(y^2)[x] == y[x], y[0] == 1}, y, {x, 0, 1}] *) Executing Clear[y, x] or even ClearAll[y, x] won't work because the problem is stored in the SubValues for Derivative: ...


1

This seems like a cell/formatting issue. Try using a new notebook. Btw, om my pc (math 10) your example gives the correct result. Cheers


1

If you have v.10 you can explicitly use the finite element method: Needs["NDSolve`FEM`"] mesh = ToElementMesh[Rectangle[{0, 0}, {10, 10}]] sol = First@NDSolveValue[{Laplacian[w[x, y], {x, y}] == 0, DirichletCondition[w[x, y] == 100, y == 0], DirichletCondition[w[x, y] == 400, y == 10], DirichletCondition[w[x, y] == 0, x == 0], ...


1

If we run WolframAlpha["y'[x] == (1 + 2 x)Sqrt[y[x]], y[0] == 1"], we can see the step by step solution, which exposes the issue at hand. WolframAlpha["y'[x] == (1 + 2 x)Sqrt[y[x]], y[0] == 1"] (* click the Step-by-step solution *) Now, I cut off the image here on purpose. Notice to solve for y[x], we had to square both sides. This could give ...



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