Linked Questions

7
votes
5answers
429 views

What is the the proper way to define a function from an expression? [duplicate]

Say after some long computation we get an expression expr=x^2 We do not know what the value of expr beforehand. Now we want ...
3
votes
1answer
2k views

Defining Piecewise Functions [duplicate]

I'm having trouble defining piecewise functions. What I have so far is a function that outputs something in a suitable format for Piecewise: ...
2
votes
2answers
148 views

Define function over expression [duplicate]

Suppose I have the following expression system = x + y + z And I would like to define a function that contains this function, without explicitly typing the right ...
1
vote
3answers
183 views

Defining a function using a preceding expression [duplicate]

How can I automatically define a function inside my Mathematica code using a result (expression) that preceded the point of definition. For example: ...
0
votes
1answer
42 views

How to turn a matrix into a 'function'? [duplicate]

I have some codes to turn a set of equations into a matrix. Suppose the matrix Lis expressed in terms of variables $\epsilon$, $K$, $M$, and I want to make a ...
0
votes
1answer
33 views

How to get a function from a list element? [duplicate]

I have a set of arguments in a list like: uy = {21/2 + y/2, 13.6667 + 0.666667 y, 20 + y} Now, I want to assign a function (call it 'f(y)') to an element of that ...
14
votes
2answers
3k views

Scoping in assigning a derivative

While answering another question, I stumbled upon a problem I cannot easily resolve. To assign the derivative of a function to another function, typically one can do this with a ...
19
votes
1answer
471 views

How to make a function like Set, but with a Block construct for the pattern names

How can we define a function that works like f[x_]=ComputeSomething[x] and treats x as a variable that does not have a value? ...
3
votes
4answers
337 views

Wrapping grid with dynamic

I'm trying to build a sortable grid: ...
5
votes
3answers
599 views

Turning an expression into a function inside another function

Say I have an expression g=Sin[q]; It is easy to turn it into a function, and to perform manipulations on this function (this and variants of this were discussed ...
-1
votes
4answers
175 views

Converting an expression to function [duplicate]

I have the following problem. I current can automatically create the variable positionPayload, for instance: ...
0
votes
1answer
34 views

Solution of a function that is in a variable [duplicate]

If I want to get the solution for a simple function, e.g. a^x, I can use: a = 2; Function[x, a^x][2] However, if I have the function in a variable, I can't get ...