# Search Results

Results tagged with Search options user 12
76 results

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

To decide whether the behaviour is resonable, let us think about a straightforward way to implement this function. I would do this: Clear[subdivide] subdivide[xmin_, xmax_, n_] := Table[xmin + (xmax …
answered Nov 23 '17 by Szabolcs
One way: myTicks[min_, max_] := Table[ Module[{q, r}, {q, r} = QuotientRemainder[x, 60]; q = Mod[q, 24]; q = IntegerString[q, 10, 2]; r = IntegerString[r, 10, 2]; StringJoin[q, ":", …
Write these definitions in a file with the extension .m or .wl. You can create such a file with the menu item New -> Package/Script -> Wolfram Language Package. Then you can load that file (i.e. eval …
These are different ways to write the same: (f[#] // Print) & Print@f[#] & Print[f[#]] & f[#] // Print & is parsed as (f[#]) // (Print &)—mind the precendence. The following are also effectively …
Trying to guess at what may be confusing to a beginner about Mathematica, the following may be helpful: In many other languages if you call a function it either stops with an error or returns with a …
answered Aug 23 '16 by Szabolcs
All functions ending in Q will always return either True or False. PrimeQ[x] evaluates to False if x is not an explicit prime number (i.e. if x is a symbol or something else). Thus your PrimeQ[f[x …
answered Dec 7 '16 by Szabolcs
Use 2 UnitStep[x] - 1 where x can be a number or any array of numbers. If you never need to handle 0, use Sign.
answered Oct 21 '16 by Szabolcs
Use Intersection for good performance. Union[{2,5}] === Intersection[{2,5},{1,2,3,4,5}]
answered Jun 2 '14 by Szabolcs
In version 10, RegionBounds@ImplicitRegion[x^2 + y^2 + z^2 == 1, {x, y, z}] (* ==> {{-1, 1}, {-1, 1}, {-1, 1}} *) FunctionRange[{y, x^2 + y^2 < 1}, x, y] (* ==> -1 < y < 1 *)
answered Jun 28 '14 by Szabolcs
same reason: avoid conflict with notebook code that doesn't have its own namespace.) The documentation has some information about which functions have changed and how. The version when the … PlotTheme -> "Classic" in plotting functions, or using the global setting $PlotTheme = "Classic" I do not know if this setting reverts all styles fully or not. Updates: PlotTheme -> None may be a … answered Jul 11 '14 by Szabolcs You can use systemFunction[x_, y_, z_] = system Note the use of = instead of := and see What is the difference between Set and SetDelayed? answered Dec 3 '14 by Szabolcs In these situations we use pattern matching instead of conditionals in Mathematica. You just need to make two definitions: f[x_?NumericQ, y_?NumericQ, s_] := ... f[x_, y_, z_] := ... The first, m … answered Mar 5 '14 by Szabolcs The reason why Solve fails here is that it does not understand that Subscript[y,1] and y are independent and unrelated. You can avoid this problem by making sure that you won't use the symbol from in … answered Feb 25 '13 by Szabolcs When I told you that this was not possible, I was wrong. My understanding is that you have points$(x_1, y_1), (x_2, y_2), ..., (x_n, y_n)$through which you construct an interpolating function$f\$. …
answered Jan 28 '12 by Szabolcs
If you have a domain, you can often find a range using Interval. Examples: In[1]:= Sin@Interval[{0, 2 Pi}] Out[1]= Interval[{-1, 1}] In[2]:= Sin@Interval[{0, Pi}] Out[2]= Interval[{0, 1}]
answered Jul 7 '12 by Szabolcs

15 30 50 per page