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 ...
• 978
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 ...
• 14.9k
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 ...
• 4,452
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 ...
• 4,209
147 views

This works: ...
• 5,462
1 vote
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 ...
• 11
1 vote
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 ...
• 145
1 vote
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 ...
• 335
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 ...
• 3,167
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)$ ...
• 137
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 <...
• 4,592