New answers tagged

1

Is this a "standard" Manipulate which will not grow larger? Ok, use one of already posted answers. Here is an alternative in case where Manipulate is supposed to be generated from a package function or is a part of a bigger code. ClearAll["Test`*"]; BeginPackage["Test`"] myManipulate::usage = "myManipulate[] generates a demo Manipulate"; Begin["`...


11

I appear to be in the minority but I never write big blocks of Mathematica code, it's just too difficult to read. The way I look at it you have to consider how a reader will understand your app. So I make the main block very small, like this: Manipulate[ Row[{ vectorPlotAndTrajectory[y0, b], Show[fy, position[y0, b]] }] , {b, -7.99, 8} , {{y0, 2}...


6

Here is the way it would look if it were my code.My formatting style is much the same as Szabolcs' (including replacing your grid with a column), but I don't like his dangling ], and you won't see those. Also, I always start control specifications on a new line, and I mostly start option specifications on a new line, too. Note: I have redefined ϕ to ...


12

Personally, I use lots of newlines and let the Front End indent. There doesn't seem to be anything special in your code, other than a lot of nesting that is in fact necessary in this case. You were using Grid incorrectly. Grid[a,b] is wrong. Grid[{{a,b}}] or Grid[{{a},{b}}] are correct. I guess you wanted Column[{a,b}], so I changed that. Using Text ...


16

Description In software engineering, it is a good practice to comment your code. I would advise you to utilise comments to partition your code in a following way. Additionally, if you have ever worked with any other programming languages, you could employ indentation. Alternatively, you could modularize your application as to develop it in smaller, more ...


1

I suppose I know what you mean. If you actually want β2 t changed while β2 keeps the constant Pi, I guess the following two codes can solve your problem: β1 = 0.; β2 = Pi; β3 = 0.; A={{Exp[I β1 + I β3] Cos[β2 t], Exp[I β1 - I β3] Sin[β2 t]}, {-Exp[-I β1 + I β3] Sin[β2 t], Exp[-I β1 - I β3] Cos[β2 t]}}; Using Animate (or Manipulate) while setting the ...



Top 50 recent answers are included