Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Retrieve a list of all dependent variables for a given expression
ResourceFunction["AllDependentVariables"][expr,ivar] gives all variables dependent on ivar within a given expr. |
Use AllDependentVariables to get the dependent variables:
In[1]:= | ![]() |
Out[1]= | ![]() |
Use AllDependentVariables to get the expressions that match dependent variable:
In[2]:= | ![]() |
Out[2]= | ![]() |
Use AllDependentVariables with a list of complicated expressions:
In[3]:= | ![]() |
Out[3]= | ![]() |
Use AllDependentVariables with an inhomogeneous first-order ordinary differential equation:
In[4]:= | ![]() |
Out[4]= | ![]() |
Use AllDependentVariables with a differential equation with a piecewise coefficient:
In[5]:= | ![]() |
Out[5]= | ![]() |
Use AllDependentVariables with a Caputo fractional differential equation of order 1/2:
In[6]:= | ![]() |
Out[6]= | ![]() |
Use AllDependentVariables with a singular Abel integral equation:
In[7]:= | ![]() |
Out[7]= | ![]() |
Find dependent variables present after reducing coefficients modulo 2:
In[8]:= | ![]() |
Out[8]= | ![]() |
For polynomials in dependent variables with numeric coefficients, AllDependentVariables and Variables gives the same results:
In[9]:= | ![]() |
Out[9]= | ![]() |
By default, AllDependentVariables extracts all variables that depend on at least one of the supplied variables, regardless of whether they have additional dependencies or the order in which the variables appear. This means that the function does not distinguish between exclusive or non-exclusive dependencies, nor does it enforce a strict order among the variables. For example, x, w, and R are all considered dependent on t:
In[10]:= | ![]() |
Out[10]= | ![]() |
When the "StrictMode"→True option is enabled, AllDependentVariables extracts only those variables that depend exclusively on the provided variables, ensuring that no additional dependencies are present. Additionally, it verifies that the order of the variables matches exactly. This is useful when strict control over dependencies and their order is required. Now, only R depends strictly on t.
In[11]:= | ![]() |
Out[11]= | ![]() |
By default, AllDependentVariables does not include derivatives when identifying dependent variables. This means that only explicitly present variables are extracted, while derivatives of dependent variables are ignored. For example:
In[12]:= | ![]() |
Out[12]= | ![]() |
When the option "IncludeDerivatives"→True is enabled, the function also includes derivatives of dependent variables in the output. For example:
In[13]:= | ![]() |
Out[13]= | ![]() |
Use AllDependentVariables with a system of delay differential equations:
In[14]:= | ![]() |
In[15]:= | ![]() |
Out[15]= | ![]() |
Use AllDependentVariables with a linear first-order partial differential equation:
In[16]:= | ![]() |
Out[16]= | ![]() |
Use AllDependentVariables to extract the dependent variables from the ImplicitD derivative that involves the symbolic functions f and g:
In[17]:= | ![]() |
In[18]:= | ![]() |
Out[18]= | ![]() |
Use AllDependentVariables to define two functions for computing the equations of motion derived from a given Hamiltonian:
In[19]:= | ![]() |
Use HamiltonianEqns with the Hamiltonian for the spherical pendulum:
In[20]:= | ![]() |
In[21]:= | ![]() |
Out[21]= | ![]() |
In[22]:= | ![]() |
Out[22]= | ![]() |
Use HamiltonianEqns with the Hamiltonian for the PUMA-Like Robot:
In[23]:= | ![]() |
In[24]:= | ![]() |
Out[24]= | ![]() |
In[25]:= | ![]() |
Out[25]= | ![]() |
Use AllDependentVariables with the resource function SymbolToSubscript:
In[26]:= | ![]() |
In[27]:= | ![]() |
Out[27]= | ![]() |
Use AllDependentVariables with the FormalizeSymbols and SolutionRulesToFunctions resource functions with the "IncludeDerivatives" option to extract dependent variables from expressions that include derivatives of them:
In[28]:= | ![]() |
In[29]:= | ![]() |
Out[29]= | ![]() |
In[30]:= | ![]() |
Out[30]= | ![]() |
Use AllDependentVariables with the resource function EulerEquations to compute the corresponding Euler-Lagrange equations of motion for the double pendulum:
In[31]:= | ![]() |
In[32]:= | ![]() |
Out[32]= | ![]() |
In[33]:= | ![]() |
Out[33]= | ![]() |
AllDependentVariables don't recognize curried functions as dependent variables:
In[34]:= | ![]() |
Out[34]= | ![]() |
AllDependentVariables looks inside nested functions:
In[35]:= | ![]() |
Out[35]= | ![]() |
In[36]:= | ![]() |
Out[36]= | ![]() |
AllDependentVariables threads composite functions to obtain the dependent variables:
In[37]:= | ![]() |
Out[37]= | ![]() |
In[38]:= | ![]() |
Out[38]= | ![]() |
Wolfram Language 13.0 (December 2021) or above
This work is licensed under a Creative Commons Attribution 4.0 International License