Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Determine whether an expression is a dependent variable
Use DependentVariableQ to identify a variable that depends on a single variable:
In[1]:= | ![]() |
Out[1]= | ![]() |
Use DependentVariableQ with a list of variables that depend on a single variable:
In[2]:= | ![]() |
Out[2]= | ![]() |
Use DependentVariableQ with a variable that depends on two variables:
In[3]:= | ![]() |
Out[3]= | ![]() |
These are not dependent variables:
In[4]:= | ![]() |
Out[4]= | ![]() |
By default, DependentVariableQ checks whether an expression depends on at least one of the supplied variables, regardless of the order or whether there are additional dependencies. This means that the function does not distinguish between exclusive or non-exclusive dependencies, nor does it consider the order of the variables. For example:
In[5]:= | ![]() |
Out[5]= | ![]() |
When the "StrictMode"→True option is enabled, DependentVariableQ verifies that the expression depends exclusively on the provided variables and that the order of the variables matches exactly. This is useful when strict control over dependencies and their order is required. For example:
In[6]:= | ![]() |
Out[6]= | ![]() |
Define a simple function to identify all dependent variables of a single variable for a given Lagrangian and Euler-Lagrange equations:
In[7]:= | ![]() |
Lagrangian for the double pendulum:
In[8]:= | ![]() |
In[9]:= | ![]() |
Out[9]= | ![]() |
Lagrangian for the spherical pendulum:
In[10]:= | ![]() |
In[11]:= | ![]() |
Out[11]= | ![]() |
Lagrangian for the PUMA-Like Robot:
In[12]:= | ![]() |
In[13]:= | ![]() |
Out[13]= | ![]() |
Use GeneralizedCoordenates with the resource function EulerEquations to compute the corresponding Euler-Lagrange equations of motion for the previously defined Lagrangians:
Euler-Lagrange equations for the double pendulum:
In[14]:= | ![]() |
Out[14]= | ![]() |
Euler-Lagrange equations for the spherical pendulum:
In[15]:= | ![]() |
Out[15]= | ![]() |
Euler-Lagrange equations for the PUMA-Like Robot:
In[16]:= | ![]() |
Out[16]= | ![]() |
Use DependentVariableQ with the resource function SolutionRulesToFunctions to convert solution rules to function rules in a given list containing rules whose left-hand side don't match with a variable that depends on other variables:
In[17]:= | ![]() |
Out[17]= | ![]() |
Use DependentVariableQ with the resource function SolutionRulesToFunctions on a more complicated list:
In[18]:= | ![]() |
Out[18]= | ![]() |
Use DependentVariableQ with the resource function SymbolToSubscript:
In[19]:= | ![]() |
Out[19]= | ![]() |
Use DependentVariableQ with the resource function FormalizeSymbols:
In[20]:= | ![]() |
Out[20]= | ![]() |
In[21]:= | ![]() |
Out[21]= | ![]() |
DependentVariableQ only identifies dependent variables that match the pattern head_Symbol[args___Symbol]:
In[22]:= | ![]() |
Out[22]= | ![]() |
Wolfram Language 13.0 (December 2021) or above
This work is licensed under a Creative Commons Attribution 4.0 International License