Tag Info

Hot answers tagged

6

Overdetermined systems of differential equations can have any solutions only if they satisfy certain compatibility conditions, therefore in general one shouldn't expect that any solutions necessarily exist. For differential equations of the first order one can impose initial conditions in the form of values of unknown functions (at certain points for ODEs) ...


5

Another way is to use Maximize rather than solving for the zero of the derivative. f[x_] = (r ω^2 Sin[x] Cos[x])/(g - ω^2 (Cos[x])^2 r); as = {r > 0, ω > 0, g > 0, r ω^2 < g}; You can see that f[x] // TrigReduce (* -((r ω^2 Sin[2 x])/(-2 g + r ω^2 + r ω^2 Cos[2 x])) *) therefore you can make a simple substitution and, assuming the ...


5

Ok, here is my take on it. Your equation appears to be a stiff one, given your initial condition in s. General First observation is that you can integrate your equation exactly. To do this, make a substitution: $\phi(s) = s'(t)$ Then, you have $s''(t) = \frac{\partial}{\partial{t}}\phi(s) = \frac{\partial\phi}{\partial{s}} \frac{\partial ...


5

One of the really nice things about Mathematica is that it lets you do symbolic computation. Perhaps the most important things it does to help you with that is to leave expressions that it doesn't know how to compute unevaluated, instead of throwing an exception or returning some useless value like Java's null or crashing. A lot of times just evaluating an ...


4

Basing on the following thread: Change variables in differential expressions and using great code by Jens for visualisation purposes (I have replaced part [vars__Symbol] with [vars__] because you are using Substripted names which are not Symbols, but that's only about visualisation). You can do the following in the first step: M2 = M /. f -> (f[#, #2, ...


4

I won't use your specific set of equations, but will answer more generally. Suppose we have the following set of first order equations with forcing: $$ \frac{d\vec{x}}{dt}=A(t,\vec{x}(t))\vec{x}(t)+f(t) $$ Suppose further that we have $A$ and $f$ already as Mathematica functions, for example, here is something random: d = 2; A[t_, x_] := {{-1, -1 ...


4

If your aim is just to solve this specific system: {rd, an} = {r[t], s[t]} /. First@DSolve[{r'[t] == 0, s'[t] == 1, r[0] == radius, s[0] == 0}, {r[t], s[t]}, t] f[u_, tm_] := CoordinateTransform["Polar" -> "Cartesian", {rd, an}] /. {radius -> u,t->tm} ParametricPlot[Evaluate[Table[f[j, t], {j, Range[4]}]], {t, 0, 2 Pi}] where ...


4

I think you need to check your equations and/or the numeric values you are using. To me it looks like this problem might well have no solution: equation = 10000 u'[r] (1 + u'[r]) - 1.`*^-6 (r + u[r]) (u[r] + r u'[r]) + 10000 r u'[r] u''[r] + 10000 r (1 + u'[r]) u''[r] == 0; derivativeAtEndPoint[uStart_?NumericQ] := NDSolveValue[{equation, 10000 ...


3

A general remark to start with - speed is in the eye of the beholder. Having said that, there are a couple of things not quite right with your code. First of all, NDSolve isn't doing what you think it does - it returns unevaluated because you didn't give an initial condition and you gave the wrong independent variable - you want to solve for f, not for ...


3

I did not see there is an easy way to do it within DSolve. But for ODEs which could be integrated directly, using Integrate would be a possible choice to get the implicit solution. For the problem mentioned, it could be integrated directly by Integrate[ Integrate[ (1 + G (A + y[x])^3) y''[x] + 3G (A + y[x])^2 (y'[x])^2 + R, x] - C[1], x] - C[2] == 0 ...


2

First, it is correct. Second p1 = Plot[{zsol[t]}, {t, 0, 5}, PlotStyle -> {Red}, PlotPoints -> 500]; error = 0.01; select[\[Phi]_] := Select[First@Cases[p1, Line[x_] -> x, Infinity], Abs[#[[2]] - \[Phi]] < error &] select[0.174] Show[p1, ListPlot[%, PlotStyle -> {Red, PointSize[0.02]}]] If you need more precision,increase PlotPoints ...


2

The error message arises because there are three possible values for f'[1] that satisfy your DE: Solve[(f'[r]^2 - 1) f'[r] r == 62/10 (f'[1])^2/1000 /. r -> 1, f'[1]] % // N (* {{Derivative[1][f][1] -> 0}, {Derivative[1][f][1] -> (31 - Sqrt[100000961])/10000}, {Derivative[1][f][1] -> (31 + Sqrt[100000961])/10000}} ...


2

What Silvia wrote about the method of lines is basically true. The problem is that NDSolve tries as much as possible to "hide" the specifics about the discretization procedure so you can't use something like u[t,x] in a WhenEvent for a PDE as x would mean "any x" and that would be inifintely many tests. But for exactly that use-case there is the possibility ...


2

I solved more general system linked by @SjoerdC.deVries in the comments reproducing figure 3 and 4 - to prove it is correct. You can simplify this to version you need. Clear["Global`*"] al = 2; a = 2/1000; k = 600; b = 1/10; g = 46/10^5; c = 1/100; m = 1/100; E1 = 1; q1 = 2/10; E2 = 813/1000; q2 = 2/100; Tf = 300; eqs = { x'[t] == al x[t] (1 - ...


2

It is a minor syntax problem. This: deq2 = DSolve[{T1''[t] == -1.062880475*10^7*T1[t] + 845.813407*T2[t], T2''[t] == 281.937803*T1[t] - 1.135556134*10^6*T2[t] - 1.807293611*10^6*T3[t] + 854.700858*(1 - 555.5555556*t)*Exp[-194.4444444*t], T3''[t] == -1.036565839*10^10*T3[t] - 6.506256977*10^9*T2[t], T1[0] == 0, T1'[0] == 0, T2[0] == 0, T2'[0] == ...


2

Short Answer Clear[Derivative] first. Long Answer OK, it's surprising that there seems to be no regular answer to this common problem for beginners, let me elaborate my comment into an answer. If you restart your Mathematica and run your code again then you'll find your problem no longer exists anymore! Then, why? Because Mathematica is unstable? Of ...


1

I can't make heads or tails of above, but perhaps this will get you started. Read the documentation - it's your best source of information. First, let's get some solution from NDSolve : sol = NDSolve[{u''[t] + u[t] == 0, u[0] == 0, u'[0] == 1}, u, {t, 0, \[Pi]}] (* {{u->InterpolatingFunction[{{0.,3.14159}},<>]}} *) So, NDSolve has given us a ...


1

This is not an answer to your question but a copy and paste from the documentation which you might find inspiring: Boundary Value Problems with Parameters In many of the applications where boundary value problems arise, there may be undetermined parameters, such as eigenvalues, in the problem itself that may be a part of the desired solution. By ...


1

The main problem is your definition of p. Try, for instance, what evaluating p[0, t] gets you: As you define it, it only works if you call it with undefined symbols. Calling it with the value of 0 in the x slot effectively evaluates D[h[0, t], 0] which is obviously nonsense. It is better to define it using Derivative: p[x_, t_] := Derivative[1, ...


1

You can always introduce a new independent variable $\psi$, so when $y$ runs from $1$ to $p$, $\psi$ runs from $0$ to $1$: ψ == Rescale[y, {1, p}, {0, 1}] $\psi =\frac{y-1}{p-1}$ Thus the ODE becomes eqs2 = {2 b[1 - ψ + p ψ, c] + 2 a[1 - ψ + p ψ] ω[ψ]^2 + Derivative[1][ω][ψ]/(-1 + p) == 0, ω[1] == 0}; Which can be solved by ...


1

If you want the term $\frac{\partial f}{\partial r}$ to disappear you need to introduce new function which would be: w2 = f[r, θ] r which means that you have to make a substitution f -> w2/r, this way: lapla1 /. f -> (w2[#, #2]/# &) // Simplify // ExpandAll If you once used f or w, don't change theirs definitions, use a new one, you ...


1

OK, I think I can give you some tips about performance here. There are a couple things you do that really tend to slow you down, and which I would describe as Mathematica "anti-patterns". In particular, building arrays by repeatedly calling AppendTo is likely to be really slow (the time taken will grow quadratically in the length of the list), and accessing ...


1

Based on the comments above \[Phi][x_] := Piecewise[{{1, Abs[x] < 1}, {0, Abs[x] >= 1}}]; pde = D[u[x, t], t] - 1/4 D[u[x, t], {x, 2}] == 0 ; soln = NDSolve[{pde, u[x, 0] == \[Phi][x]}, u[x, t], {x, -5, 5}, {t, 0, 10}] ffn[x_, t_] = u[x, t] /. soln // First Animate[Plot[ffn[x, t], {x, -5, 5}, PlotRange -> {{-5, 5}, {0, 1}}, Filling -> Axis, ...


1

It turns out the issue is to do with mathematics and not Mathematica. The OP's code yields an error: ic1 = 0; ic2 = 0; ic3 = 1; a = 0; sol = NDSolve[ {y'''[x] + y[x] y'[x] - y'[x]^2 - a^2 y'[x] == 0, y[0] == ic1, y'[0] == ic2, y'[Infinity] == ic3}, y[x], {x, 0, 1000}]; NDSolve::ndsv: Cannot find starting value for the variable y'. >> ...


1

A solution for scalar transfer functions with delays. The main function accepts the numerator and denominator of the transfer function. tfmToTimeDomain[{num_, den_}, ipvar_, opvar_, s_, t_] := Catch[polyToTimeDomain[den, opvar, s, t] == polyToTimeDomain[num, ipvar, s, t]] A function to extract the numerator and denominator: tfmToTimeDomain[tf_, ...



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