24

This question is too interesting to resist, so I'll talk about how to analyze the problem. Take a look at sketch above. It describes an arbitrary moment during the rolling. From the kinematics view, $P$ is the "instant center of rotation". From the energy view, the square's center of mass $O$ keeps its height, thus the potential of the square doesn't change,...


12

Well, without Table and such: Riffle[Range[9], Range[0, 8]] Or, we can use SequenceFunction: FindSequenceFunction[Riffle[Range[9], Range[0, 8]]] (* 1/4 (-1)^#1 (-3 + (-1)^(1 + #1) + 2 (-1)^#1 #1) & *) So: 1/4 (-1)^#1 (-3 + (-1)^(1 + #1) + 2 (-1)^#1 #1) & /@ Range[18]


12

1. You can use HorizontalGauge as a control in Manipulate: Manipulate[Plot[Sin[x + phi], {x, 0, 2 Pi}], {phi, 0, 2 Pi, Panel[HorizontalGauge[##, ScaleDivisions -> None, Axes -> {True, False}, ImageSize -> 250, Ticks -> {Transpose[{Subdivide[8], Subdivide[0, 2 Pi, 8]}], None}], #, Right] &}] To allow only discrete values, say ...


8

If you have to use Table you can get the desired result with 23 characters: Table[## &[i, i - 1], {i, 9}] {1, 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8} "Table[##&[i,i-1],{i,9}]" // StringLength 23 If not you can save a few key strokes using Array[## &[#, # - 1] &, 9] {1, 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8} ...


8

UpTo should do it: Take[list, UpTo[10]] and Part[list, ;; UpTo[10]]


8

There is an option called Paneled to control the outer frame. Setting this option to False should do the trick. Manipulate[Plot[Sin[x (1 + a x)], {x, 0, 6}], {a, 0, 2}, Paneled -> False]


7

A workaround is to ReleaseHold the plot. Plot has gotten very complicated. I don't really know what they are trying to address exactly. Some of it has to do with data, Quantity[] etc.; some has to do with plot themes; and then there some other stuff I don't get. Workaround: Manipulate[ ReleaseHold@ Plot[0.4 + 0.001 x m, {x, 0, 1400}, PlotRange -&...


7

f[n_]:= Sequence[n, n - 1] Array[f, 9] (*{1, 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8}*) or Flatten@Array[{#, #-1}&, 9] (*{1, 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8}*)


7

26 characters is the shortest I can think of: {#, # - 1} & /@ Range@9 // Flatten


7

You need I.C., so made one for you. Feel free to change it. I also changed your notation to make it more common. The dependent variable is $u(x,t)$ and the space variable is $x$. In both solutions below, this initial conditions is used To make it consistent with boundary conditions. Feel free to change it. Solve for $u(x,t)$ with $t>0, 0<x<L_0$ ...


7

When you had Manipulate[ x = {a, a}*# & /@ {{1, 1}, {2, 2}}; x = {1, 0}*# & /@ x; , {a, 1, 10} ] Then since a=1 initially, then the first line x = {a, a}*# & /@ {{1, 1}, {2, 2}} produces x={{1, 1}, {2, 2}} and then the second line x = {1, 0}*# & /@ x produces x={{1, 0}, {2, 0}}, so x has changed. Because of this, and since you did not ...


7

This can be done with just a couple lines and pretty quickly. First define your ODE and your system parameters ode = ϕ''[t] + g/l Sin[ϕ[t]] == 0; params = Table[{g -> 9.81, l -> 11 - a}, {a, 1, 10}]; Make a Table of all the numerical solutions: sols = Table[NDSolve[Evaluate[{ode, ϕ'[0] == 0, ϕ[0] == π/4} /. params[[i]]], ϕ[t], ...


7

The problem is that you must pass a and b to the function. Try f[3] with your current definition and you get 3a + 9b which cannot be plotted. When using SetDelayed (:=), it cannot see that there is an a and b inside the function so it does not know where to assign the values. Instead, try this: f[x_, a_, b_] := a x + b x^2 Manipulate[Plot[f[x, a, b], {x, 0, ...


7

Manipulate[ plt = ContourPlot[ Cos[x + y] Sin[k x - 3 y], {x, -2, 2}, {y, -2, 2}, PlotPoints -> 20, PlotRange -> {{-2, 2}, {-2, 2}}, Axes -> True, AxesOrigin -> {0, 0}, AxesStyle -> Directive[GrayLevel[0.5]], AxesLabel -> {Style["X", Bold, 14], Style["Y", Bold, 14]}, ...


7

EDIT I have found something simplier than my first answer: Apply Setting to the Manipulate to obtain a normal graphic. Then to remove all the options of this graphic, one way is to take the first part and reapply Graphic END EDIT OLD ANSWER You can use the Snapshot function in the Manipulate. Then remplace DynamicModule by With (this may not be necessary), ...


7

To remove only the outer panel keep the frame around the content area, you can use Style + DefaultOptions as follows: Style[#, DefaultOptions -> {Panel -> {Background -> White}}] & @ Manipulate[Plot[Sin[n x], {x, 0, 2 Pi}], {{n, 3}, 0, 10, 1}]


6

Flatten@NestList[#+1&,{1,0},8] {1, 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8} In addition Array[{#,#-1}&,9,1,Join] and Array[{#+1,#}&, 9,0,Join]==Array[{#,#-1}&, 9,1,Join] Original Post NestList[#+{1,1}&, {1,0},8]//Flatten


6

Try this: Manipulate[ SomeFunction[SensorSize], {SensorSize, {A122 -> "A122", A122B -> "A122B", A322 -> "A322"}, ControlType -> SetterBar}] with the effect Have fun!


5

Decimation of mesh is not a trivial task if you want to preserve the visual features of the original mesh. If you want to tap into the efforts of people that have been working on the problem for many years, you could use the freely available MeshLab to perform the decimation with a script driven from Mathematica. Here is one possible workflow (Note: ...


5

Update: Using Trigger to trigger/pause/reset the timer: DynamicModule[{time, lim = 10.}, Manipulate[ParametricPlot[{Sin[θ + d[[1]]], Sin[θ + d[[2]]]}, {θ, 0, 2 Pi}, PlotStyle -> color, ImageSize -> Small], Row[{Dynamic @ PaddedForm[Round[1. - time, .001], {3, 3}], Spacer[5], ProgressIndicator[Dynamic@(1 - time), {0, 1}], Control[{{...


5

I'd do it this way: Manipulate[ x^n, {x, -10, 10, 1, Appearance-> "Labeled"}, {{n, 2}, {2 -> "square", 3 -> "cube"}}]


5

Use your function to define a parametric curve (say, curve) and use it with ParametricPlot and add the moving circle asEpilog. The normal to the curve at point t is Cross[Normalize[curve'[t]]] so we can easily find the center of moving circle: ClearAll[curve] curve[x_] := {x, x} Manipulate[ParametricPlot[curve[x], {x, -Pi, 3 Pi}, Epilog -> {Red, ...


5

One way could be Manipulate[ Module[{y, x}, Plot[y = -3*x + 2, {x, from, to}, AspectRatio -> Automatic, PlotRange -> {{from, to}, {from, to}}] ], {{from, -10, "from"}, -10, -0.01, .01, Appearance -> "Labeled"}, {{to, 10, "to"}, 0, 10, .01, Appearance -> "Labeled"}, TrackedSymbols :> {from, to} ] If you meant the from and to ...


5

You got few things wrong in translating Python to Mathematica. a = -1; b = 1; nnn = 100; grid = Subdivide[a, b, nnn - 1]; f[xx_, t_] = Exp[-2 (xx - t)^2]; ListLinePlot[ Evaluate@Table[{grid, f[grid, t]} // Transpose, {t, 0, 0.9, 0.1}]] First np.arange(0,1,0.1) gives array([0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]) and not to {t, 0, 10} and np....


5

In MATLAB, what I generally use, you can just use the 'hold on' command. There is no hold on in Mathematica, but you can add a point to a plot in many ways. One is to use Epilog Code Clear["Global`*"]; fx[a_, b_, c_, d_, u_, L0_, x_, y_] := x*(L0 - a*x - b*y) fy[a_, b_, c_, d_, u_, L0_, x_, y_] := y*(u - c*x - d*y); xCoord[a_, b_, c_, d_, u_, L0_] := (...


5

Add some Dynamic[] and a variable to keep track of the selected tab: Manipulate[Row[{ Dynamic@TabView[{ 1 -> Pane[Row[{pt[[1]], pt[[2]]}, "\t"], 150], 2 -> Pane[Row[{2*pt[[1]], 2*pt[[2]]}, "\t"], 150], 3 -> Pane[Row[{3*pt[[1]], 3*pt[[2]]}, "\t"], 150] }, Dynamic@i], LocatorPane[Dynamic@pt, ...


5

dtpts1a = Table[RandomInteger[{1,100}],{i,128},{j,2}]; Manipulate[ MapAt[n*#&, dtpts1a, {All,2}] ,{n,0,1}] EDIT By default Manipulate uses steps of 10^-3 * rangeMax for the variable. You can decrease the step size and use SetAccuracy to always show four digits Manipulate[ SetAccuracy[MapAt[n*#&, dtpts1a, {All,2}],5] ,{n,0,1,0.0001}]


5

In Manipulate >> Details and Options allowed forms of the second argument are listed: So HorizontalGauge[Dynamic[x], {0,10}] (or, for that matter, Slider[Dynamic[x], {0, 10}] or Checkbox[Dynamic[z]] or InputField[Dynamic[w]] etc.) is not allowed in the second (or later) argument. The highlighted row of the list is elaborated on as So using Row @ {...


5

With your revised initial and boundary conditions $Version (* "12.1.1 for Mac OS X x86 (64-bit) (June 19, 2020)" *) Clear["Global`*"] kc = 0; eqns = { D[y[t, x], t] == D[D[y[t, x], x], x] + y[t, x]^3 - z[t, x], D[z[t, x], t] == D[D[z[t, x], x], x] + y[t, x] - k*z[t, x] + kc, y[0, x] == 0.3, z[0, x] == 0.1, y[t, -2] == 0.3, ...


5

Manipulate[Plot[Evaluate@ OutputResponse[TransferFunctionModel[(5/(s^2 + 2 s)*K1)/(1 + 5/(s^2 + 2 s)*(K2*s + K1)), s], UnitStep[t], {t, 0, 10}], {t, 0, 4}, PlotRange -> {0, 3}], {{K1, 1}, 0, 3}, {{K2, 2}, 0, 3}]


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