# Search Results

Results tagged with Search options user 125
171 results

Questions about the use of built-in Mathematica functions, including pure functions.

f = ListInterpolation[{1, 0, -1, 0, 1}, InterpolationOrder -> 0, PeriodicInterpolation -> True][10 #] &; Row[Plot[f@x, {x, 0, #}, Frame -> True, PlotStyle -> Thick, Axes -> False, ImageS …
answered May 11 '15 by kglr
Give f the Attribute HoldFirst: ClearAll[f] f[A1_] := (A1[] = 1; A1) SetAttributes[f, HoldFirst] A = {0, 0, 0}; f[A] {1, 0, 0}
answered Aug 6 by kglr
fF[x__Integer] := FromDigits[Join @@ IntegerDigits @ {x}] fF[1, 2] (* 12 *) fF[2, 4, 65] (* 2465 *)
answered Jun 17 '15 by kglr
Use the three-argument form of Thread: Thread[f[{a, b, c}, {0}], List, 1] (* {f[a, {0}], f[b, {0}], f[c, {0}]} *) See also Thread >> Details Examples: Thread[h[{0}, {a, b, c}], List, {2}] (* …
answered Mar 5 '15 by kglr
You can find the details of how the third argument of Ellipsoid is processed by inspecting the code which is available in the package MultiDescriptiveStatistics.m. nb = NotebookOpen[ToFileName[{\$Inst …
answered Jun 27 '14 by kglr
points = {{0, 5.9}, {18, 5.56}, {22.32, 0}}; Graphics[{Red, PointSize[Medium], Point@points, Blue, BezierCurve[points, SplineDegree -> 1], Thick, Green, BezierCurve[points]}, Frame -> True, Asp …
answered May 15 '16 by kglr
Change your definition of a[k] and b[k] as (as Mr.W suggested in comments) a[k_] := Piecewise[{{20/(k^4 Pi^4), EvenQ[k]}, {-83/(k Pi), OddQ[k]}}] b[k_] := Piecewise[{{-92/(k^3 Pi^3), EvenQ[k]}, {-53/ …
answered Jun 24 '12 by kglr
You can use FromDigits as follows: coeffs = {c1, c2, c3, c4, c5}; ExpandAll @ FromDigits[Reverse[Prepend[coeffs, 0]], x] c1 x + c2 x^2 + c3 x^3 + c4 x^4 + c5 x^5 ClearAll[gmodel] gmodel[n_] : …
answered Mar 7 by kglr
For the ultimate goal, you can use the internal function SystemDateListPlotDumpDateTicks to generate the date ticks: ClearAll[hourminuteTicks] hourminuteTicks = MapAt[Round[#/60] &, System`DateL …
answered Feb 21 by kglr
FunctionDomain In versions 10+, you can use the built-in FunctionDomain: f[x_]:=1/(x-3); FunctionDomain[f[x], x] (* x<3||x>3 *) Not[%]//FullSimplify (* x == 3 *) or, more directly, Not[FunctionDo …
answered Sep 5 '14 by kglr
Distribute[f[g[x]], g] (* g[f[x]] *)
answered Nov 6 '14 by kglr
Also Through[{1 & /@ # &, Cos, Sin}@xval] {{1, 1, 1, 1}, {Cos[a], Cos[b], Cos[c], Cos[d]}, {Sin[a], Sin[b], Sin[c], Sin[d]}} Or, if func[x_]:={1, Cos[x],Sin[x]} is already defined, Through[(F …
answered Oct 27 '16 by kglr
List @@ f[1, 2, 3] {1, 2, 3} List @@ f[Sin[x], Cos[x], 4, 7] {Sin[x], Cos[x], 4, 7} or f[Sin[x], Cos[x], 4, 7] /. f -> List {Sin[x], Cos[x], 4, 7} f[1, 2, 3] /. f -> List { …
answered Jul 4 '17 by kglr
f1 = Which[# < 10, ## &[#, 0], # > 10, ## &[0, #]] &; f2 = ## & @@ Which[# < 10, {#, 0}, # > 10, {0, #}] &; f3 = ## & @@ {Append, Prepend}[[1 + Boole[# > 10]]][{#}, 0] &; f4 = ## & @@ {Identity, Rever …
answered May 20 '15 by kglr
ClearAll[lst, pos]; lst = Array[{Subscript[a, #]} &, {8}] (* {{Subscript[a, 1]}, {Subscript[a, 2]}, {Subscript[a, 3]}, {Subscript[a, 4]}, {Subscript[a, 5]}, {Subscript[a, 6]}, {Subscript[a, 7 …
answered May 27 '14 by kglr

15 30 50 per page