# Tag Info

1

Your code for your model is wrong. As others are saying, your forcing function is $\cos(\omega t)$. Therefore, you simply use NDSolve to obtain solution. eq =theta''[t] + b/(m L0^2) theta'[t] + g/L0 Sin[theta[t]] -T0 Cos[w t]/(m L0^2); ic = {theta'[0] == Pi, theta[0] == 1}; b = 0.22; m = 1; L0 = 1; g = 9.8; w = 1; T0 = 1; sol = First@NDSolve[{eq == 0, ic}, ...

2

The first step in debugging is always to narrow down the problem. To do this, you can make ncurve global: DynamicModule[{(* ncurve = {} *) }, EventHandler[ ... Then, you can click on the image and evaluate ncurve in a separate cell: Length[ncurve] 248652 (You can and should put ncurve in a DynamicModule once you're done, of course. But for ...

4

you could start with a simple hack of your code to extract the intersections; Something like {x1, y1} = Transpose[line]; {x2, y2} = Transpose[RotateLeft[line]]; gr2 = {(x1^2 - x1*x2 + y1*(-y1 + y2)), (y1 - y2)} // Transpose // Most; which can be encapsulated in the ellipseSimLowLevel as follows ellipseSimLowLevel[ellPos_, θ_, aimAt_, refls_, ...

13

The problem relates to the granularity of MachinePrecision numbers. The number 70.329862 is represented as an integer times a power of 2: x0 = SetPrecision[70.329862, Infinity] (* 4949024067128413/70368744177664 *) (The denominator is 2^46.) The machine numbers near this number do not allow for the representation of 70.329862 with \$MachinePrecision ...

8

EDIT Input gets different rounding to machine-precision real if it's written in arbitrary precision! RealDigits[70.329862, 2] (* {{1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1}, 7} *) RealDigits[ SetPrecision[70.329862000000000000, ...

6

Try this: Solve[c == 0.0625 + 0.0008*X - 0.0232*Y - 0.0157*Z + 0.0059*X^2 + 0.0112*Y^2 + 0.0160*Z^2 - 0.0063*X*Y - 0.0243*X*Z + 0.0211*Y*Z // Rationalize, Z] (* {{Z -> 1/320 (157 + 243 X - 211 Y - \[Sqrt](-375351 + 6400000 c + 71182 X + 21289 X^2 + 82226 Y - 62226 X Y - 27159 Y^2))}, {Z -> 1/320 (157 + 243 X - ...

0

I've managed to do some optimization of the code, using matrix operations instead of loops (or tables) whenever possible and changing the main loop from a For to a Do as suggested. The ParallelTable command (also suggested) seems not to work inside a Manipulate. The computation time has reduced by a factor of 10 (more or less) and it's now possible to build ...

4

you can also try UnitStep Manipulate[ Plot[{f[u] /. subs, f[u] UnitStep[u - a] UnitStep[b - u] /. subs}, {u, 0, 5000}, PlotRange -> All, Filling -> {2 -> Axis}, Epilog -> {PointSize[Large], Point[{{a, f[a] /. subs}, {b, f[b] /. subs}}]}] , {a, 0, 4000}, {b, 100, 4000}]

4

I am guessing you want to do something like Manipulate[ Column[{Row[{With[{a = a, b = b}, HoldForm[Integrate[f[u] /. subs, {u, a, b}]]], Integrate[f[u] /. subs, {u, a, b}]}, " = "], Plot[{ConditionalExpression[f[u] /. subs, a <= u <= b], f[u] /. subs}, {u, 0, 5000}, PlotRange -> All, ...

2

Not sure if it is what you are after: action[dog_] := Print@StringForm["take dog no. for a walk", dog]; RadioButtonBar[Dynamic[dog, (dog = #; action[dog]) &], {1, 2, 3}]

0

Well, I haven't quite understood your request for a Dynamic approach (I don't see the why or how of it) but since no one else has responded, here is what I can cook up in a few minutes: Clear[G] G[n_] := G[n] = Module[{e1, e2, Gr = G[n - 1], m = Length[G[n - 1]], t}, e1 = RandomInteger[{1, m}]; e2 = RandomInteger[{1, m}]; While[Gr[[e1, 2]] ...

7

Just a kickstart to get the equations right (yours are wrong) and an idea of the system dynamics: With[{Pr = 10, a = 1.181, b = 0.675, v = 0.77, l = 8/3}, pfun = ParametricNDSolveValue[{ x'[t] == Pr v (y[t] - x[t]), y'[t] == R (b/v) x[t] - a y[t] - (b/v) (R - (a v)/b) x[t] z[t], z'[t] == a l (x[t] y[t] - z[t]), x[0] == y[0] == 0.8, ...

1

Based on comments, I came to the following approach: DynamicModule[ {nn, tn, dist, dataAll, data, dx, func, wave, f}, ColumnForm[{ Button["New data", dataAll = RandomVariate[dist, 2000]; data = Take[dataAll, nn]; func = CalcG1[wave, data, 0, Ceiling[Log2[nn] - Log2[Log2[nn]]]]; f = func[tn]; ], PopupMenu[Dynamic[wave, ...

Top 50 recent answers are included