# Tag Info

6

{x1, x2} = x /. Solve[x^2 + 3 x + 2 == 0, x] {-2, -1} Motivated by eldo's answer: Here a function that does the assignment, if there is only one variable, but even without knowing the number of solutions. f[sol_] := Evaluate@Array[Symbol[ToString@sol[[1, 1, 1]] <> ToString@#] &, Length@sol] = Last @@@ sol f[Solve[x^2 + 3 x + 2 == 0, x]] ...

4

diameter[x_List] := Max[EuclideanDistance @@@ Subsets[x, {2}]] diameter[pointset] (* 2 Sqrt[5] *) Now, let's improve the performance "a little bit". I believe the maximal distance will be realized at the points' convex hull (I'll not demonstrate it,but it's quite intuitive). Now, if you have a lot of points Mathematica provides a convenient and fast way ...

3

I still like the differential way (below), but here's a direct way. It is similar to the linked duplicate, Change variables in differential expressions, but I don't conflate $f$ and $\tilde f$, which error is made by its OP and adhered to in the answers. Let f0 represent $\tilde f$. Then f is equivalent under the change of variables, to f == Function[{t, ...

3

Perhaps something like: ClearAll[func]; func[add_, pos_: (-1)] := N@FromDigits@MapAt[# + add &, RealDigits[##], {{1, pos}}] & func[4, -1][12.007, 10, 5] (* 12.011 *) func[4, -3][12.707, 10, 5] (* 13.107 *)

2

Truncate early and often. f[0] = f0; f[n_] /; n > 0 := f[n] = Sum[ Series[1/(6 + j x) n (1/x + j f[n - 1]), {x, 0, 0}], {j, 1, 4}]; Timing[ res = Series[ Sum[Series[1/(2 + n x) (n/x + f[n]), {x, 0, 0}], {n, 1, 6}], {x, 0, 0}]] (* Out[140]= {0.012000, SeriesData[x, 0, { Rational[1016635, 162], Rational[5, 486] (-3351289 + 835701 f0)}, ...

1

A certain generalization using an indexed variable: r = FindInstance[Sin[x] == Cos[x] && -10 < x < 10, x, Reals, 15] // Values // Flatten // N {-5.49779, 7.06858, 0.785398, -8.63938, 3.92699, -2.35619} Map[(x[#] = r[[#]]) &, Range @ Length @ r]; {x[1], x[2], x[3], x[4], x[5]} {-5.49779, 7.06858, 0.785398, -8.63938, 3.92699, ...

1

This works for me in version 10.0.0 under Windows: NotebookFind[EvaluationNotebook[], "\[Placeholder]"] Since: NotebookFind[obj,data] sets the current selection in the specified notebook object to be the next occurrence of data. This must be placed at the top of the Notebook when it is run.

1

There are ways to do this with replacement, as comments suggest. However, it can be messy if you're jumping in with a two-variable function. Let's work from the examples to see how it goes: f'[x] /. f -> (f[g[#]] &) This makes a substitution from $f'(x)$ where $x=g(x)$ (or, more appropriately, $g(t)$): f'[t] /. f -> (f[g[#]] &) This ...

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