# Tag Info

8

For the "Simplified Code" provided in the OP's last edit, Λ in the definition of KS is identically 1, and the argument of FindRoot in the definition of KS is frarg = χ (Λ^4) /κ^2 - χ + 2 Log[κ] + 2 L/(Pi 60000000) Cos[Pi s] (* -0.041872 + 0.041872/κ^2 + 2. Cos[π s] + 2 Log[κ] *) Zeros of frarg are shown in ContourPlot[frarg == 0, {s, -1/2, 1/2}, {κ, 0, 1}...

5

I'll start with the equation the OP uses in the FindRoot[] call. It can be simplified and solved exactly symbolically. The following eq1, eq2, and eq3 are equivalent under the indicated transformations: Clear[a, b, s, κ, L, χ, Λ]; cvt = {a -> 2 L/(Pi 60000000) Cos[Pi s] - χ, (* convert to OP's "Simplified coode" *) b -> χ (Λ^4)}; eq1 = χ (Λ^...

3

Two ways: J[k_, f_] := f''[k] + f'[k] + f[k] J[k, r[#] phi[#] &] // Simplify Or J[k, f] /. f -> (r[#] phi[#] &) // Simplify Out: (* {2 phi'[k] r'[k] + r[k] (phi'[k] + phi''[k]) + phi[k] (r[k] + r'[k] + r''[k])} *) One can go further, too: J[k, f]/f[k] /. f -> (r[#] phi[#] &) // Expand; % /. {r'[k] -> lr'[k] r[k], phi'[k] ->...

3

This evaluates without errors: z[x_] := 2458.31 - 100.087 x + 1.23213 x^2 - 0.0046743 x^3 lamavg[t_] := Min[1, 0.01 + 0.07 z[t]] Ufit2[M_, t_] := 0.50519 + 3.127*10^10/M^2 - 274337/M + 2.12127*10^-10 M - 1.92858*10^-20 M^2 - 6.20762*10^-11 t; e = 1/100; l = (126/100)*10^(31); sol = 3*^8; DifEq = D[P[M, t],t] == -M l/ sol^2 D[(1 - e)/e ...

2

One way to avoid the discontinuity of the branch cut in ArcTan is to integrate its derivative. This also converts the DAE, which is restricted to use the IDA method, to an ODE. This allows greater flexibility in integrating the system. In this case, the default settings seem to work well as is. g = 9.81; (*Gravitational acceleration*) m0 = 50000; (*...

2

One of the methods I've used with stiff systems is to reduce the PrecisionGoal (and sometimes AccuracyGoal). Check the result for reasonableness. Solution = NDSolve[{ x''[t] == If[t < 30, T/m[t] Cos[theta Degree], 0], y''[t] == If[t < 30, T/m[t] Sin[theta Degree], 0] - g, m'[t] == If[t < 30, -(T/(g Isp)), 0], gamma[t] == ArcTan[x'[t]...

2

Here is the code again: Manipulate[ ParametricPlot[ Evaluate[{x[t], v[t]} /. Quiet@NDSolve[{x'[t] == v[t], v'[t] == μ (1 - x[t]^2) v[t] - x[t], x[0] == xv0[[1]], v[0] == xv0[[2]]}, {x[t], v[t]}, {t, 0, tt}]], {t, 0, tt}, PlotRange -> {{-4, 4}, {-4, 4}}, AxesLabel -> {TraditionalForm["x[t]"], TraditionalForm["v[t]"]}],...

2

Clear[x] solv = NDSolve[{ D[u[t, x], {t, 2}] - D[u[t, x], {x, 2}] == 0, u[t, 30] == 0, u[0, x] == E^(-x^2), Derivative[1, 0][u][0, x] == 0}, u[t, x], {t, 0, 2000}, {x, -30, 30}, Method -> {"MethodOfLines", "SpatialDiscretization" -> {"TensorProductGrid", "MinPoints" -> 50, "MaxPoints" -> 50, "DifferenceOrder" ->...

1

This is both an extended comment and an a qualitative answer. First, because e is used for two different quantities, it is prudent to execute Clear[e] at the beginning of the code. Second, the definition of lamavg is missing. From a related question, it probably is lamavg[t_] := Min[1, 0.01 + 0.07 zedInt[t]] Third, the NDSolve Method used seems to ...

1

I think substituting a in the definition of int, which is called by a is trouble, and what you really need is to make sure int isn't evaluated when z[t] isn't a number. The following seems to work, albeit not very quickly: Clear[a]; f[t_] := Sin[t^2]; int[t_?NumericQ, z_?NumericQ] := NIntegrate[Exp[-f[t]*z*v^2], {v, 0, 1}]; a = NDSolve[{ x'[t] == -3*(x[...

1

For the example problem, you can get a result that may be what you are seeking by a change of variable. y[s] == z[s]^2 Table[D[%, {s, n}], {n, 0, 2}] Append[%, z[s] (s - z[s] z''[s] - z'[s]^2) == 0] Eliminate[%, Table[D[z[s], {s, n}], {n, 0, 2}]] Assuming[y[s] != 0 && y'[s] != 0, FullSimplify[%]] DSolve[{%, y[0] == 1, y[3] == 4}, y, s] Plot[Sqrt[y[s]...

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