Linked Questions

9 votes
3 answers
17k views

Passing a function as an argument of another function [duplicate]

Possible Duplicate: Pass function or formula as function parameter I am trying to implement a simple Plot[]-like function, with the same synopsis; my first (and unique so far) try would be ...
zakk's user avatar
  • 978
8 votes
4 answers
442 views

Identify the independent variable in an expression [duplicate]

Suppose that you write something like this for your students. This is just the beginning of something I would like to write to help them with the formal definition of a limit, but I am puzzled by the ...
David's user avatar
  • 14.9k
12 votes
2 answers
833 views

Duplicate the swap function

Because defining the function: swap[x_, y_] := Module[{}, t = x; x = y; y = t; Return[]] and writing: swap[x, y] {x, y} I ...
πρόσεχε's user avatar
7 votes
3 answers
423 views

Get unevaluated option value?

This is kind of a follow-up to this question. I want to be able to define a function that takes an option, and then, inside the function, retrieve and test the unevaluated value of the option. For ...
rogerl's user avatar
  • 4,209
3 votes
2 answers
147 views

Why does this function fail when a non-function version of the same code works?

This works: ...
George Wolfe's user avatar
  • 5,462
1 vote
2 answers
145 views

I want Mathematica to evaluate $\int(1 + \delta (x - \text {x0})) p[x] dx$ as $p[x0]+\int p[x] dx$, where $p[x]$ remains unspecified

I define the simple function: Simp[h_] := Integrate[h[x] p[x], {x, -∞, ∞}] where the function p[x] is continuous, but I want ...
Roy S.'s user avatar
  • 11
1 vote
1 answer
124 views

Implementing a function so it accepts functions, function names and expressions as an argument

I'm trying to write a Mathematica function which takes an arbitrary expression as input. More concretely, I'm trying to write an integration function (utilizing the trapezoidal method), the input of ...
Paul Eugenio's user avatar
1 vote
1 answer
115 views

User-defined density plotting function with a functional argument: extracting variables from the function and plotting in a circular region

I would like to customize the function DensityPlot and use it in a package as a function called MyDensityPlot: The functions ...
sekisushai's user avatar
0 votes
2 answers
112 views

Supply a function as an argument to another, and find its minimum

I would like to minimize a function, which is supplied as an argument to another function, and report back the estimates of the values of the variables that result in its minimum. In specific, I would ...
ben18785's user avatar
  • 3,167
0 votes
2 answers
69 views

How to define specify parameter functions of a Sturm-Liouville operator & plot its effect on specific functions?

I have a Sturm-Liouville operator: $$\mathcal{Ly(x)}=-\frac{\mathrm{d}}{\mathrm{d}x}\left(p(x)\frac{\mathrm{d}}{\mathrm{d}x}y(x)\right)-q(x)y(x)$$ but I do not yet know the parameter functions $p(x)$ ...
zabop's user avatar
  • 137
0 votes
1 answer
56 views

Locally (de)assigning a value

I have failed in adapt the methods discussed in $\qquad$Pass function or formula as function parameter to my work. I would like to know if there is a way to say the following to Mathematica: If <...
cyrille.piatecki's user avatar
0 votes
0 answers
39 views

Imitate Integrate's behavior with regard to the integrand parameter (scoping/naming)

Using Integrate, I can do any of the following: ...
rogerl's user avatar
  • 4,209