Tag Info

Hot answers tagged

5

list1 = {a, b, c, d}; Rest[FoldList[Times, 1, list1]] Scan[Print, %] a a b a b c a b c d


3

However, is there something you can put in the code to set the speed? Animate takes an option AnimationRate I still haven't been able to draw the bottom part of the first animation on https://courses.engr.illinois.edu/tam212/avt.xhtml#avt and note how it continues to move to the right (without everything jumping around). I think you can get as ...


3

My version of Bob Hanlon's comment solution: list1 = {a, b, c, d}; FoldList[Times, list1] % // Column {a, a b, a b c, a b c d} a a b a b c a b c d Reference: Shorter syntax for Fold and FoldList?


3

You can also use Accumulate list1 = {a, b, c, d}; Times @@@ Accumulate[list1] (* or Accumulate[list1] /. Plus -> Times *) {a, a b, a b c, a b c d} ... or ReplaceList: ReplaceList[list1, {x__, ___} :> Times[x]] {a, a b, a b c, a b c d}


3

The "canonical" way in Mathematica is f[x_, y_] := x^2 + y^2 g[x_, y_] := x^4 + 4 x y + 2 y^4 - 8 Maximize[{f[x, y], g[x, y] == 0}, {x, y}] If you want to make explicit usage of the Lagrange multiplier: ss = Solve[ Thread[Grad[f[x, y] + lambda g[x, y], {x, y}] == 0 && g[x, y] == 0], {x, y, lambda}, Reals] // N gives the {x,y} ...


2

My comment in Manipulate form: func = {x^2 + x y + y^2}; Manipulate[ D[func, variable], {variable, {x, y}} ] The control that Manipulate uses is the SetterBar[Dynamic[variable], {x, y}] of my comment.


2

Replace m by μ/λ to impose the condition m λ = μ. I assume r = {x, y, z} and k = {0, 0, 1}; then you want Norm for vectors, since Abs is for complex/real numbers. Block[{r = {x, y, z}, k = {0, 0, 1}}, Limit[-m ((Norm[r + 1/2 λ k] - Norm[r - 1/2 λ k]) / (Norm[r + 1/2 λ k] Norm[r - 1/2 λ k])) /. m -> μ/λ, λ -> 0] // Simplify[#, r ∈ ...


2

r = {x, y}; a = {a1, a2}; expr = 1/Sqrt[(r - a).(r - a)] - 1/Sqrt[(r + a).(r + a)]; (Series[expr, {a1, 0, 1}, {a2, 0, 1}] // Normal) /. x^2 -> R^2 - y^2 // PowerExpand // Factor (* (2 (a1 x + a2 y))/R^3 *) Have fun!



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