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.
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
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 …
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} *)
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 …
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 - …
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 …
1
vote
Detecting errors and providing alternative results
You have a fundamental error in your use of MatrixForm: as things stand, the value of distanc is not a (nested) list to which you can Apply another function; rather, distanc is just a special output f …
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 …
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.) …
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 …
0
votes
0
answers
56
views
Head of complex sum
Purpose: I'm trying to use functions defined in the form
func[{a_Complex, b_Complex}]:= ... … The same problem already arises with complexLine, among the other functions, proffered there. …
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 …
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 …