# Tag Info

23

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, Range[0, 8]] Or, we can use SequenceFunction: FindSequenceFunction[Riffle[Range, 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

10

Your curves show a bit strange case when central point keeps the same altitude. However, such situation can be simulated by the following way: R = 1; ϕ = π/4; center = {#, 1} &; crn = {center@# + {-R Cos@(# + ϕ), R Sin@(# + ϕ)}, center@# + {-R Cos@(# + ϕ + π/2), R Sin@(# + ϕ + π/2)}, center@# + {-R Cos@(# + ϕ + π), R Sin@(# + ϕ ...

9

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

8

Look carefully at the documentation for NDSolve and Manipulate and see if you can understand how every character of this is working. You can even click on the orange Details and Options for each of those to get additional information. And then Manipulate[ sol=u/.NDSolve[{D[u[t,x],t]==α D[u[t,x],{x,2}]+a u[t,x], u[t,0]==0,u[t,Pi]==0,u[0,x]==x(Pi-x)},u,{...

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} ...

7

Manipulate[Plot[# Sin[#2 t], {t, 0, 2 π}, PlotStyle -> #3] & @@ setter, {{setter, {1, 10, Black}, Row[{"{A", "ω", "pStyle}"}, ","]}, {{1, 10, Black}, {2, 15, Red}, {3, 5, Blue}}}]

7

I think adding another frame will do what you want. Like so: Manipulate[ Framed[ Framed[ GraphicsGrid[ {{Graphics3D[Background -> Green, ImagePadding -> 20], Graphics3D[Background -> Yellow, ImagePadding -> 0]}}, Background -> LightGray, ImageSize -> {400, 200}, Frame -> True], ...

7

To make it a bit shorter n = 4 (*number of corners*) crn = {Cos[#/n 2 Pi], Sin[#/n 2 Pi]} & /@ Range[n]; cen = {0, 1}; v[t_] = {t, 0};(*linear velocity*) w[t_] = -0.2 t 2 Pi;(*angular velocity*) tmax = 10; dt = 0.1; trj = Table[(cen + v[t] + RotationMatrix[w[t]].#) & /@ crn, {t, 0, tmax, dt}]; ListAnimate[Table[Graphics[{Gray, Polygon[t], Black, ...

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

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

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

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, ϕ == π/4} /. params[[i]]], ϕ[t], ...

7

The problem is that you must pass a and b to the function. Try f 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, ...

6

The problem is that Manipulate can't handle multiple variables for a single control, as you've probably noticed. One simple approach is to introduce a helper variable (setting in the code below) that can be set to the triples of values, which are then distributed onto the individual variables: Manipulate[ {A, ω, pStyle} = setting; Plot[A Sin[ω t], {t, 0, ...

6

You can add a Locator to this answer by halirutan: With[{pts = Append[#, First[#]] & @ Table[{r {Cos[phi], Sin[phi]}, phi/(2 Pi)}, {phi, 0, 2 Pi, .1}, {r, 0, 1, .1}]}, DynamicModule[{pt = {.5, .5}}, Graphics[{Polygon[{{0, 0}, First[#1], First[#2]}, VertexColors -> (Hue /@ {{0, 0, 1}, Last[#1], Last[#2]})] & @@@ Partition[...

6

Here is kglr's solution rewritten using LocatorPane, which I think makes the code a little simpler and perhaps clearer. I have also made some changes. the locator is configured to appear a sa disk the plot label shows the position of the disk as a complex number With[ {pts = Append[ #, First[#]]& @ Table[{r {Cos[phi], Sin[phi]}, ...

6

You can use the Method suboption "ControlAreaDisplayFunction" to modify the control labels to have the same size: Manipulate[a, Control[{a, 0, 1, 0.1}], Dynamic[If[a < 1, Control[{{abc, 0}, {0, 1}}], Control[{{abcdef, 0}, {0, 1}}]]], ControlPlacement -> Left, ContentSize -> {100, 100}, Alignment -> Center, Method -> {"...

6

How about putting everything in the grid? Like so: Manipulate[a, Dynamic @ Grid[ {{"Slider", Control[{{a, 0, ""}, 0, 1, .1}]}, {"Checkbox", Control[{{b, 1, ""}, {1, 0}}]}, {Button["Button 1"], SpanFromLeft}, {If[a == 0, Button["Button 2"], Button["Button 3"]...

6

You can use Show to modify the background of the Graphics expression returned by GraphicsGrid: Manipulate[ Framed[ Show[ GraphicsGrid[ {{Graphics3D[Background -> Green, ImagePadding -> 20], Graphics3D[Background -> Yellow, ImagePadding -> 0]}}, Background -> LightGray, ImageSize -> {400, 200}, Frame -> True, ...

6

Since this can be readily solved analytically using seperation of variables, another option is to use the analytical solution, and replace the paramaters in the solution without the need to solve it each time. Mathematica can't solve this analytically, but the analytical solution is  u \left( x,t \right) =\sum _{n=1}^{\infty }-4\,{\frac {\sin \left( nx ...

6

By the following proof, we can know that the horizontal ordinate of the center of the rectangle is the same as that of the tangent point. (x + (1 - ArcLength[-Cosh[t] + Sqrt, {t, 0, x}]) Cos[ ArcTan[D[-(Cosh[x]) + Sqrt, x]]] + (x - (1 + ArcLength[-Cosh[t] + Sqrt, {t, 0, x}]) Cos[ ArcTan[D[-(Cosh[x]) + Sqrt, x]]] - 2*...

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

5

Manipulate[ListPlot[Map[ReIm[#[[1, 2]]] &, Solve[z^n == pt.{1, I}, z]], AspectRatio -> 1, PlotRange -> {{-1, 1}, {-1, 1}}], {n, 2, 128, 1}, {{pt, {1, 1}}, Locator}]

5

Dynamic[t]*d is a quick fix but there is another problem. By using outer Module variables in Manipulate you may end up with broken Manipulate if you intend to save it as a cdf etc. Module variables definitions will not survive kernel reset. You can rewrite your example a little: cylJoints[R_, r_, {z1_, z2_}] := Manipulate[ Module[{b, cyl, d}, b = ...

5

You need to remove one level of braces: data1 = {{1, 2}, {2, 3}}; data2 = {{1, 2}, {3, 4}}; Manipulate[ ListPlot[chooseData], {chooseData, {data1, data2}, ControlType -> PopupMenu} ] Or a bit more sophisticated: data1 = {{1, 2}, {2, 3}}; data2 = {{1, 2}, {3, 4}}; names = {"data1", "data2"}; ass = Association[#[] -> #[] & /@ ...

5

You can put your Controls in a Column to lay out your controls in a arbitrary way. From here, you can use the Alignment option for Column. Manipulate[a, Column[{Control[{{a, 0}, {0, 1}}], Dynamic[If[a == 0, Control[{{abc, 0}, {0, 1}}], Control[{{abcdef, 0}, {0, 1}}]]]}, Alignment -> Right], ControlPlacement -> Left]

5

A custom toggler grid with the desired look: ClearAll[togglerGrid] togglerGrid[Dynamic[y_], vals_, dims_, cols_: {RGBColor[.36, .67, .38], Lighter@ Lighter@RGBColor[.36, .67, .38]}, size_: {15, 20}] := Deploy @ Grid[ArrayReshape[Table[With[{i = i}, Item[Setter[Dynamic[MemberQ[y, i], BoxForm`TogglerBarFunction[y, i] &], {True}, i, ...

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