Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Generate a polynomial with random terms
ResourceFunction["RandomPolynomial"][var] generates a random polynomial in var with maximum degree 5. | |
ResourceFunction["RandomPolynomial"][var,maxdegree] generates a random polynomial in var with maximum degree maxdegree. | |
ResourceFunction["RandomPolynomial"][varlist,maxdegree] generates a random polynomial with maximum degree maxdegree in each of the elements of the varlist. | |
ResourceFunction["RandomPolynomial"][varlist,degreelist] generates a random polynomial each of the elements of the varlist with degree chosen from degreelist. | |
ResourceFunction["RandomPolynomial"][var,degree,termcount] generates a random polynomial with the number of terms given by termcount. |
"TermMultiplierDistribution" | the distribution to draw term multipliers from | DiscreteUniformDistribution[{-100,100}] |
Generate a random polynomial in x:
In[1]:= |
Out[1]= |
Generate a random quadratic in x:
In[2]:= |
Out[2]= |
Generate a random polynomial in x of maximum degree 100:
In[3]:= |
Out[3]= |
Generate a random polynomial in x of maximum degree 100 with 3 terms:
In[4]:= |
Out[4]= |
Restrict to only even powers of x:
In[5]:= |
Out[5]= |
RandomPolynomial can generate a polynomial in multiple variables:
In[6]:= |
Out[6]= |
RandomPolynomial can generate polynomials in any kind of expression, not just symbols:
In[7]:= |
Out[7]= |
Generate a Laurent polynomial by including negative order terms:
In[8]:= |
Out[8]= |
Generate a polynomial whose coefficients are integers in the range [0,100]:
In[9]:= |
Out[9]= |
Generate a polynomial with normally-distributed coefficients:
In[10]:= |
Out[10]= |
Requesting more terms than are possible causes a failure:
In[11]:= |
Out[11]= |
This work is licensed under a Creative Commons Attribution 4.0 International License