# Tag Info

8

The output looks fine to me. It is, however, relatively complicated. Consider the following simpler example Minimize[x (x - c), x] (* Out: {-c^2/4, {x -> c/2}} *) Thus, there is a minimum value of $y=-c^2/4$ at $x=c/2$, as expected. Now, let's complicate things slightly. Minimize[c x (x - c), x] This is a piecewise expression, which is ...

6

Manipulate[ p = {x, s@x} /. Last@Minimize[{s@x, l > x > 0}, {x}]; Plot[s@x, {x, 0, l}, Epilog -> {PointSize[Large], Point@p}, PlotLabel -> p], {l, 1, 10}, Initialization :> {s@x_ := 1/2 Sqrt[(l^4 + x^4)^2/(l^4 x^2)]}]

6

It takes less work to use the definition of a generating function directly than by typing FindGeneratingFunction: In[1]:= Sum[Mod[n, 2] x^n, {n, 0, Infinity}] Out[1]= -(x/((-1 + x)*(1 + x)))

4

p[z] = GeneratingFunction[Mod[n, 2], n, z] CoefficientList[Normal@Series[p[z], {z, 0, 10}], z] (* -(z/(-1 + z^2)) *) (* {0, 1, 0, 1, 0, 1, 0, 1, 0, 1} *)

4

It is possible to find generating functions using FindGeneratingFunction, but the finite list you provide to it has to be long enough: seq = ConstantArray[{0, 1}, 5] // Flatten Table[FindGeneratingFunction[seq[[;; n]], x], {n, 10}]

4

Since you give the constraint l > x > 0, you should make use of that constraint f[x_] = 1/2 Sqrt[(l^4 + x^4)^2/(l^4 x^2)]; min = FullSimplify[ Minimize[{f[x], l > x > 0}, x], l > x > 0] min[[1]] == Simplify[f[x /. min[[2]]], l > 0] True f'[x] /. min[[2]] 0 Simplify[(f''[x] /. min[[2]]) > 0, l > 0] True

2

here is another way to approach the problem...

1

For Replace you must include the levels at which to map the replacement. By default it does not map to subparts. g[y_] := Replace[f[y], y^2 -> y, Infinity]; Print["Method 2: g(y)=", g[y]]; For /. {Replace All} your syntax is incorrect. g[y_] := f[y] /. y^2 -> y; Print["Method 3: g(y)=", g[y]];

1

Are you sure you didn't make a mistake? Perhaps you didn't replace both instances of n with n+1? josephus1[m_Integer, n_Integer] := If[m == 1, m, Mod[josephus[m - 1, n + 1] + n, m] + 1] josephus1[40, 6] returns 24 and josephus1[40, 5] returns 28.

1

Here is a one-liner josephus[howmany_Integer?Positive, which_Integer?Positive] := Nest[Rest[RotateLeft[#, which]] &, Range[howmany], howmany - 1] By the way the explicit formula for the problem is given in Knuth book .

1

Your Area results in a special function output with an assumption. You can force the evaluation simply by appending //N Area[2 Sqrt[(1 - p^2)^2 - r^2], {p, 0, 1}, {r, 0, 1 - p^2}] (* Integrate[-(-1 + p^2) Sqrt[1 + 16 p^2] EllipticE[-(3/(1 + 16 p^2))], {p, 0, 1}, Assumptions -> 0 < 1 - p^2] *) Area[2 Sqrt[(1 - p^2)^2 - r^2], {p, 0, 1}, {r, 0, 1 - ...

1

How about something like Options[NArea] = Options[NIntegrate]; NArea[R__, ops:OptionsPattern[]] := Internal`InheritedBlock[{Integrate}, Unprotect[Integrate]; Integrate[Shortest[e__], r___Rule] := NIntegrate[e, ops]; Area[R] ] NArea[2 Sqrt[(1 - p^2)^2 - r^2], {p, 0, 1}, {r, 0, 1 - p^2}] 2.38377

1

If you use SetDelayed then you loop will call Abort. With Set (=) res2 has not value at all. You can check it evaluating: a =. ; a = Abort[] (*new cell*) a a So: res = 0; res2 = ""; CreateDialog[{TextCell["Do you want to continue calculations?"], Button["Proceed", DialogReturn[res2 = True]], Button["Cancel", ...

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