Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Questions about the use of built-in Mathematica functions, including pure functions.
29
votes
3
answers
750
views
Cyclic Take function? [duplicate]
For example, if the functions were named OverTake, then:
OverTake[{1, 2}, 5]
(* {1, 2, 1, 2, 1} *)
(This would be a direct analog of the take functions in the array-processing languages APL and J.) …
15
votes
Scan vs. Map vs. Apply
For a visual, animated, description of basic behavior of such functions, I recommend:
http://reference.wolfram.com/legacy/flash/
(You may want to turn on your computer's sound.) …
10
votes
4
answers
2k
views
How make f[{x,y}] evaluate as f[x,y]? [duplicate]
I frequently encounter the situation where I have a function of two real variables defined, e.g.:
f[x_, y_] := 9 - x^2 - y^2
But then I need to feed into f not just two numbers but rather a pair, i …
7
votes
1
answer
203
views
What kind of creature is h[c] for definition h[c_][x_] := (* function of x and c *)
To implement "Hero's Method" for approximating $\sqrt{c}$, one iterates the function (x + c/x)/2 for a given number c (e.g., 2) starting with some initial value of x. This can be implemented by defini …
5
votes
What are equations on mathematica and differences between these errors?
First, a basic mistake: in Mathematica, the natural log base is entered as E (or as Esc e Esc), and not plain e. And many folks prefer Exp[x] to E^x.
Also, your lines f[1];, f[2];, etc., since they e …
4
votes
Accepted
How to use external Mathematica Code?
Note that there is another, newer, way to store definitions that may suit your purposes: to store then as local objects (or even as cloud objects), then retrieve them when needed. I'll illustrate with …
4
votes
1
answer
464
views
How hide symbolic definition of a function?
How can the actual definition of a function be hidden from a user?
I want the user of a notebook to be able to evaluate a real-valued function f of a real variable at any particular numeric input yet …
4
votes
Accepted
Plotting a Wavefunction
a = 30;
f[x_] := Sqrt[2/a] (3/5 Sin[2 \[Pi] x/a] + 4/5 Sin [(9 \[Pi] x)/a])
Plot[f[x], {x, 0, a}, AxesLabel -> {x, "f(x)"},
PlotStyle -> {Black, Dashed}]
Note that you forgot the closing ) in th …
3
votes
Accepted
Trouble creating a bifurcation diagram of a trajectory
As noted, you didn't show a Mathematica definition of f. Moreover, the definitions of traj is incorrect, and the syntax of Manipulate is wrong. Here's a corrected, complete version:
f[x_, a_] := a - …
2
votes
How to use ForAll in Reduce
Perhaps you mean something like this:
f[{x1_, x2_}, {y1_, y2_}] := x1 y2 - x2 y1
Reduce[ForAll[{x1, x2, y1, y2},
{x1, x2}.{y1, y2} <= f[{x1, x2}, {y1, y2}]]]
2
votes
How to define and use a linear function
For the record... no function, whether defined by SetDelayed (:=) or Set (=) expliclty or by constructing a pure function (using # and &) is needed. To wit:
-800 {3, 7} + 12000
{9600,6400}
2
votes
Efficient way to test if all the elements in a list are Integers?
Use Map, abbreviated /@. For example:
lis = {4, 5/2, 3., 6/3, Pi};
IntegerQ /@ lis (* or Map[IntegerQ, lis] *)
(* {True, False, False, True, False} *)
2
votes
0
answers
130
views
Which functions automatically generate new functions?
output from
dict = Nearest[WordData[]]
is a NearestFunction object -- a function that may then be evaluated at an input such as:
dict["eleephannt"]
{elephant}
How can one determine which other functions …
1
vote
How to get the correct answer when solve this equation?
I don't think this is substantially different from what @Daniel Lichtblau proposed, but it directly uses your code up to the final Solve expression, where it also uses the trick of squaring in order t …
1
vote
Transformation of a simple logic statement
In Mathematica:
Reduce[ForAll[{x, y}, x <= y \[Equivalent] x < y + 1], Integers]
(* True *)
or:
Resolve[ForAll[{x, y}, x <= y \[Equivalent] x < y + 1], Integers]
(* True *)
For a mathem …