Linked Questions

9 votes
3 answers

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

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

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

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

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

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

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

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

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

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

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

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