# Tagged Questions

148 views

### Defining a function with parameters as variables

I have an expression V = (a[1] + a[2])b[1]. How would I define a function of a[1], a[2] and ...
395 views

### What is the right way to write a function that includes other functions?

I want to include multiple sub functions: $b(x) = 10x$ $w(x) = s + b(x)$ $c(x) = x^2$ into two main functions: $ua(x) = w(x)-c(x)$ $ub(x) = w(x)-c(x)^2$ As a reaction to this answer, I wrote ...
70 views

### Determining whether or not an expression is an integer

I'd like to define a function that controls if a certain number is an integer, rational, algebraic and so far. First, I tried generating a list of those numbers: ...
103 views

### A question about two ways to use Default

Usually we define a function with default values by the syntax x_:default, but there is another technique to do this by registering a global default value with ...
84 views

### How to input pure function to package?

I would like to input a pure function into a custom written package, but am running into a variety of errors. The package I have created is as follows: ...
83 views

### Normalize equation in NDSolve?

I have numerically solved and plotted the solution to the Mathieu equation using NDSolve successfully, as below: ...
41 views

### Convert variable into function

Sorry if this is a duplicate, but I have a variable called H. H is some complicated function of ...
386 views

### Multiply each element of an array by another array?

I would like to multiply an array by each element of another array, and am having a lot of trouble finding a built-in or automated method of doing. Here is an example of what I'd like to achieve: ...
41 views

### Using Table[ ] vs using Do[Append [ ] ] [duplicate]

Is it generally better/faster to use the Table function over using Do[Append []]? For example, I have this piece of code: ...
101 views

### Holding Input Windows

I am creating a Mathematica document which contains a list of proofs in various fields of Mathematics so that I can easily review whenever I would like. First, I create a large set I call 'proofs' ...
165 views

### Please explain this code (contains Append, Do, Coefficient)

I am a graduate student using a past student's Mathematica program. Will someone please explain to me exactly what this piece of code is doing? Specifically the ...
86 views

### Is it possible to use a mathematical expression as function name?

This might seem as a silly question, but is it feasible to use a mathematical expression as the name of a function? For example, I'm studying the cross section of Compton scattering and there is a ...
222 views

### Writing a function that returns a (usable) function

I am trying to create a function that returns Arnold's Cat Map of size n iterated k times. I can get something out of the Function command, but I can't figure out ...
105 views

### How to make InverseFunction work on function defined with restriction on arguments

This example works to define InverseFunction on the first argument of a function ...
448 views

### Constructing symbol definitions for With

I would like to be able to define two arrays, one containing symbol names and one containing the values of those symbols, for use in constructs such as With. For ...
418 views

### How to create custom Graphics primitive?

How to create custom Graphics primitive? It should have the following properties, resembling properties of built-in geometric figures, like ...
913 views

### Why is there no PositionFunction in Mathematica?

Too often I have seen the programs of inexperienced users greatly slowed by using Position in an iterative fashion, when far faster would have been to compute a ...
328 views

### Write a function that returns the logarithmic derivative

How can we write a function that if we input an expression f, it returns the log derivative $\frac{1}{f} \frac{df}{dx}$. We have to use a conditional or pattern test so that the function accepts any ...
684 views

### Why function cannot be defined inside For loop? [closed]

I have a following code (which is simplified version of what I am doing): For[i = 1, i <= 5, i++, f[x_] := Sin[x]^2 Print[{i, f[i]}] ] And the question ...
317 views

### Why does the first derivative of a piecewise continuous function have discontinuities?

I have this piecewise continuous function which is also continuously differentiable over time : ...
282 views

### Functions that remember their values

Can someone explain what is going on with the following ... func[y_] := func[y] = (Print["Hello world !!!"];) func[1] Hello world !!! ...
362 views

### More than one expression in the Table[] command?

I would like to construct a Matrix using the Table[] command. The issue is that I would like to use more than one expression for it. What I need to obtain is something like this : ...
158 views

### How to generalize a formula?

This is a piece of my code: ...
I am trying to calculate an integral involving multiple indicator functions, such as:  h(u,v,w) = -\int_0^1 J^{\prime\prime}(s) (I_{(0,s]}(u) - s)(I_{(0,s]}(v) - s)(I_{(0,s]}(w) - s)\, ...