# How can I define parameters and set them equal to each other dynamically?

1 view (last 30 days)
Aaron Zheng on 23 Sep 2021
For a high school essay, I have the following problem. I have a set of 24 parameters(defined by the command syms) which take positive real values, and a list of 19 independent algebraic equations that relate to each of those parameters. For the sake of convenience, lets assume my parameters are can be expressed with set {a_n, where 1<=n<=24 }
What I want to determine is the maximum amount of the parameters {a_n} that can have equal value, such that the set of parameters still satisfy the 19 equations. As a result, I need to be able to set every possible permutation of k parameters equal to each other.
Currently, the method I'm brainstorming is to define a vector that contains the set, such as this:
vec = [a, b, c, d, e, f, g, h, i1, j1, k, l, m, z, o, p, q, r, s, t, u,v,w,x,y];
and then use the nchoosek function on the set vec to choose all possible permutations of some size, say size. Then, I loop through all permutations, and manually define size-1 new equations defining two variables as equal to each other.
Then, I plug in the original 19 equations, as well as the size-1 new equations into a solve function to get my answer.
Is there an easier way to set parameters equal to each other?

R2020a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by