Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Define a function based on its action on given mathematical expressions
ResourceFunction["DefineFunctionByFormula"][{f[form1,vars1]⧴expr1,f[form2,vars2]⧴expr2,…}] defines a function f so that f[form,vars] returns expr where the same set of substitutions transforms formi,varsi, and expri to form,vars, and expr, respectively. |
Define downvalues for a function f:
| In[1]:= |
Evaluate f at an expression that fits the formula:
| In[2]:= |
| Out[2]= |
Define downvalues for a function f using multiple rules:
| In[3]:= | ![]() |
| Out[4]= | ![]() |
Evaluate f at an expression that fits the formula:
| In[5]:= |
| Out[5]= |
Specify which symbols are to be considered non-variable parameters, as opposed to fixed values:
| In[6]:= |
| Out[7]= | ![]() |
Evaluate the function at an expression that fits the formula:
| In[8]:= |
| Out[8]= |
The function does not evaluate for the following input because c is a fixed value as opposed to a non-variable parameter, so it cannot be set equal to 2:
| In[9]:= |
| Out[9]= |
Define a function based on an indefinite integration formula (ignoring the constant of integration):
| In[10]:= | ![]() |
Evaluate the function at an expression that fits the formula:
| In[11]:= |
| Out[11]= |
Wolfram Language 13.0 (December 2021) or above
This work is licensed under a Creative Commons Attribution 4.0 International License