Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Get a pure function whose argument is a vector for a given multivariable scalar function
ResourceFunction["ScalarPureFunction"][s,vars] gives the corresponding pure function representation of a multivariable scalar function s for a vector of variables vars. | |
ResourceFunction["ScalarPureFunction"][s] represents an operator form that can be applied to arguments. |
Define a function of two variables taking as input a vector of variables:
In[1]:= |
Out[1]= |
Apply the function:
In[2]:= |
Out[2]= |
Use ScalarPureFunction to obtain a linear pure function of three variables and evaluate it at (1,-2,1):
In[3]:= |
Out[3]= |
In[4]:= |
Out[4]= |
Use ScalarPureFunction to obtain a transcendental pure function of three variables and evaluate it at (1,1,1):
In[5]:= |
Out[5]= |
In[6]:= |
Out[6]= |
The IndexingMethod option allows specifying the method used to indexing elements of argvars in the ScalarPureFunction. By default, the method is set to "UseIndexed", which uses the Indexed function. Alternatively, can be set the option to "UsePart" to use the Part function. This option provides flexibility in choosing the preferred method of indexing elements of argvars within the ScalarPureFunction:
In[7]:= |
Out[7]= |
To generate a height map for an imaginary mountain in the shape of a two-dimensional Gaussian function, use ScalarPureFunction to represent the height at each point of the mountain as follows:
In[8]:= |
Out[8]= |
In[9]:= |
Out[9]= |
In[10]:= |
Out[10]= |
Use ScalarPureFunction in combination with ClickPoincarePlot2D to plot Poincaré sections of particle motion near a black hole horizon:
In[11]:= |
In[12]:= |
Out[12]= |
Poincaré sections of the Yang-Mills-Higgs system:
In[13]:= |
In[14]:= |
Out[14]= |
Use ScalarPureFunction in combination with ResourceFunction["TensorPureFunction"] to compute a Hessian matrix:
In[15]:= |
Out[15]= |
In[16]:= |
Out[16]= |
Wolfram Language 13.0 (December 2021) or above
This work is licensed under a Creative Commons Attribution 4.0 International License