RandomTools
GenerateSimilar
create a random expression similar to the one given
Calling Sequence
Parameters
Description
Examples
Compatibility
GenerateSimilar( expr )
expr
-
integer, float, polynomial, or general expression
The GenerateSimilar command produces a new expression that is similar to the given expression expr. The structure and variables in the original expression are preserved, but new constants and coefficients replace the initial ones. The random floating-point numbers and integers in the new expression are the same magnitude as in the original.
Trig functions are not always preserved: sin and cos can switch, sec and csc can switch, and tan and cot can switch. The inverse trig functions are paired and can switch in the same way.
Inputting a polynomial that can be factored and has integer roots returns a polynomial of the same order that can be factored and has integer roots.
If a polynomial is input without integer roots then a polynomial up to the same degree as the input polynomial with random coefficients up to the same order of magnitude as the largest integer in the input expression is returned.
Numerators and denominators of input rational expressions are replaced in the same way as polynomials with the additional feature that if the numerator and denominator have a common root then the returned rational expression also has a shared root in its numerator and denominator.
If a singular square matrix is input then a singular square matrix is output. Inputting upper triangular, lower triangular, diagonal, symmetric, hermitian, or antisymmetric matrices returns the same type. Otherwise the elements of the output matrix are generated individually from each element of the input matrix.
Rational and integer exponents of functions or expressions (other than exponential functions) are preserved.
If an integral is passed into the function then the resultant integral will be solvable using the same integration technique (u substitution, partial fractions, trig substitution, integration by parts).
If an equation is passed into GenerateSimilar then a similar equation is output: radical equations produce radical equations, polynomial equations produce polynomial equations, logarithmic equations produce logarithmic equations, and exponential equations produce exponential equations.
Sums over values of binomial or poisson probability distributions produce sums over values of binomial or poisson probability distributions respectively.
Expectation value of a function over a binomial or poisson probability distribution returns an expectation value of a similar function over a binomial or poisson probability distribution respectively.
Integrals over values of exponential or gaussian probability distributions return integrals over values of exponential or gaussian probability distributions respectively.
Expectation value of a function over an exponential or gaussian probability distribution returns an expectation value of a similar function over an exponential or gaussian probability distribution respectively.
Parametrizations of circles, ellipses and cycloids return parametrizations of circles, ellipses and cycloids.
Differential equations should not be input into GenerateSimilar; for differential equations use GenerateSimilarODE.
with⁡RandomTools:
GenerateSimilar⁡x
4⁢x+2
The cube on the sin function is preserved.
GenerateSimilar⁡sin⁡x3+3⁢exp⁡x2
−5⁢cos⁡x−73−5⁢ⅇ−4⁢x2+3⁢x
Inputting a factorable polynomial returns a factorable polynomial..
factor⁡r2+r−6
r+3⁢r−2
poly1≔GenerateSimilar⁡r2+r−6
poly1≔r2−6⁢r−16
factor⁡poly1
r+2⁢r−8
A polynomial without integer roots returns a polynomial with random coefficients
solve⁡r2−2⁢r+2=0
1+I,1−I
GenerateSimilar⁡r2−2⁢r+2
r2+r+2
Factorable numerators and denominators remain factorable and if a factor is shared between the numerator and denominator then the resultant rational function will share a factor between numerator and denominator.
factor⁡y2−1y−3
y−1⁢y+1y−3
rational1≔GenerateSimilar⁡y2−1y−3
rational1≔−y2+4⁢y−3−y−4
factor⁡rational1
y−1⁢y−3y+4
factor⁡y2−1y+1
y−1
rational2≔GenerateSimilar⁡y2−1y+1
rational2≔−y2+11⁢y−24−y+3
factor⁡rational2
y−8
Singular matrices return singular matrices.
with⁡LinearAlgebra:
Determinant⁡Matrix⁡3,3,2,4,6,2,0,2,6,8,14
0
matrix1≔GenerateSimilar⁡Matrix⁡3,3,2,4,6,2,0,2,6,8,14
matrix1≔03−3−206−16−3
Determinant⁡matrix1
Diagonal matrices return diagonal matrices.
matrix2≔Matrix⁡3,3,1,0,0,0,−2,0,0,0,7
matrix2≔1000−20007
GenerateSimilar⁡matrix2
4000−10005
Upper triangular matrices return upper triangular matrices.
matrix3≔Matrix⁡3,3,2,−4,3,0,5,7,0,0,−6
matrix3≔2−4305700−6
GenerateSimilar⁡matrix3
99207800−9
Lower triangular matrices return lower triangular matrices.
matrix4≔Matrix⁡3,3,3,0,0,−1,5,0,7,10,−3
matrix4≔300−150710−3
GenerateSimilar⁡matrix4
1000770310−1
Symmetric matrices return symmetric matrices.
matrix5≔Matrix⁡3,3,1,−9,7,−9,π,3,7,3,2
matrix5≔1−97−9π3732
GenerateSimilar⁡matrix5
5−22−2−5⁢π61214
Hermitian matrices return hermitian matrices.
matrix6≔Matrix⁡3,3,2,−I,7+2⁢I,I,3,8−4⁢I,7−2⁢I,8+4⁢I,1
matrix6≔2−I7+2⁢II38−4⁢I7−2⁢I8+4⁢I1
GenerateSimilar⁡matrix6
53⁢I8−3⁢I−3⁢I46−3⁢I8+3⁢I6+3⁢I9
Skew-symmetric matrices return skew-symmetric matrices.
matrix7≔Matrix⁡3,3,0,1,−4,−1,0,7,4,−7,0
matrix7≔01−4−1074−70
GenerateSimilar⁡matrix7
0−3630−4−640
If the matrix doesn't fall into one of the above categories GenerateSimilar is mapped to every element in the matrix
matrix8≔Matrix⁡3,3,1,3,x,sin⁡x,−2,ln⁡x2,−6,3.1,−45
matrix8≔13xsin⁡x−2ln⁡x2−63.1−45
GenerateSimilar⁡matrix8
61−8⁢x+7−7⁢cos⁡9⁢x+6−109⁢ln⁡2⁢x2+4⁢x−99.0−13
Integration technique: u substitution.
GenerateSimilar⁡%int⁡2⁢x+2⁢exp⁡x2+2⁢x+7,x
∫12⁢x−4⁢ⅇ6⁢x2−4⁢x−9ⅆx
Integration technique: partial fractions.
GenerateSimilar⁡%int⁡x+7x2−4,x
∫−x+5x2+6⁢x−7ⅆx
Integration technique: trig substitution.
GenerateSimilar⁡%int⁡sqrt⁡x2+1,x
∫6⁢−x2+6ⅆx
GenerateSimilar⁡%int⁡x⁢sqrt⁡x4+1,x
∫−8⁢−x4+5⁢xⅆx
GenerateSimilar⁡%int⁡sqrt⁡exp⁡2⁢x+1,x
∫−−ⅇ−2⁢x+3ⅆx
Integration technique: integration by parts.
GenerateSimilar⁡%int⁡x⁢ln⁡x,x
∫2⁢x−3⁢ln⁡−x+3ⅆx
GenerateSimilar⁡%int⁡2⁢x3−3⁢x2⁢ln⁡x−2,x
∫−4⁢x3+9⁢x2⁢ln⁡x−3ⅆx
GenerateSimilar⁡%int⁡x⁢exp⁡x,x
∫−8⁢x⁢ⅇ6⁢xⅆx
GenerateSimilar⁡%int⁡x⁢cos⁡x,x
∫−600⁢x⁢cos⁡−2⁢xⅆx
GenerateSimilar⁡%int⁡exp⁡x⁢cos⁡x,x
∫27⁢ⅇ2⁢x⁢cos⁡7⁢xⅆx
GenerateSimilar⁡%int⁡arccos⁡x,x
∫arccos⁡−6⁢x+6ⅆx
Integration resulting in an erf function will give back integration resulting in an erf function.
simplify⁡%int⁡exp⁡−x2,x
∫ⅇ−x2ⅆx
integral1≔GenerateSimilar⁡%int⁡exp⁡−x2,x
integral1≔∫ⅇ−3⁢x2+3ⅆx
simplify⁡integral1
∫ⅇ−3⁢x−1⁢x+1ⅆx
Integration resulting in an Si function will give back integration resulting in an Si function.
simplify⁡%int⁡sin⁡xx,x
∫sin⁡xxⅆx
integral2≔GenerateSimilar⁡%int⁡sin⁡xx,x
integral2≔∫7⁢sin⁡9⁢x−7−54⁢x+42ⅆx
simplify⁡integral2
−7⁢∫sin⁡9⁢x−79⁢x−7ⅆx6
Integration that results in an arctan function will give back integration resulting in an arctan function.
simplify⁡%int⁡1x2+1,x
∫1x2+1ⅆx
integral3≔GenerateSimilar⁡%int⁡1x2+1,x
integral3≔∫−3−4⁢x2−3ⅆx
simplify⁡integral3
3⁢∫14⁢x2+3ⅆx
A double integral will produce a double integral;
integral14≔%int⁡%int⁡sin⁡x⁢cos⁡y,y=0..π,x=π2..π
integral14≔∫π2π∫0πsin⁡x⁢cos⁡yⅆyⅆx
GenerateSimilar⁡integral14
∫3⁢π42⁢π∫−π3059⁢π60−432⁢cos⁡−10⁢x⁢cos⁡−9⁢yⅆyⅆx
A polynomial equation will produce a polynomial equation. If the input equation has integer roots the output equation will have integer roots.
equation1≔x2+x−9=2⁢x−3
solve⁡equation1
3,−2
newEquation1≔GenerateSimilar⁡equation1
newEquation1≔x2+4⁢x−38=x+2
solve⁡newEquation1
5,−8
Radical equations with rational solutions will produce radical equations with rational solutions or no solutions.
equation2≔sqrt⁡3⁢x2+10⁢x−5=0
equation2≔3⁢x2+10⁢x−5=0
solve⁡equation2
53,−5
newEquation2≔GenerateSimilar⁡equation2
newEquation2≔10=x2−7⁢x+110
solve⁡newEquation2
5,2
equation3≔sqrt⁡2⁢x2−x+3sqrt⁡x2−2⁢x+9=1
equation3≔2⁢x2−x+3x2−2⁢x+9=1
solve⁡equation3
2,−3
newEquation3≔GenerateSimilar⁡equation3
newEquation3≔12⁢x−30−x2+6⁢x+10=1
solve⁡newEquation3
−10,4
equation4≔sqrt⁡2⁢x2−x−3=sqrt⁡x2−2⁢x+9
equation4≔2⁢x2−x−3=x2−2⁢x+9
solve⁡equation4
3,−4
newEquation4≔GenerateSimilar⁡equation4
newEquation4≔−3⁢x2+15⁢x+5=−4⁢x2+7⁢x−11
solve⁡newEquation4
−4
equation5≔2⁢x=sqrt⁡x+3
equation5≔2⁢x=x+3
solve⁡equation5
1
newEquation5≔GenerateSimilar⁡equation5
newEquation5≔2⁢x=14⁢x−10
solve⁡newEquation5
1,52
equation6≔2⁢xsqrt⁡x+3=1
equation6≔2⁢xx+3=1
solve⁡equation6
newEquation6≔GenerateSimilar⁡equation6
newEquation6≔2⁢x14⁢x2−99⁢x−10=1
solve⁡newEquation6
10
equation7≔12⁢x=1sqrt⁡x+3
equation7≔12⁢x=1x+3
solve⁡equation7
newEquation7≔GenerateSimilar⁡equation7
newEquation7≔17⁢x=157⁢x2−2⁢x−10
solve⁡newEquation7
54
equation8≔1+sqrt⁡1−x=sqrt⁡2⁢x+4
equation8≔1+1−x=2⁢x+4
solve⁡equation8
newEquation8≔GenerateSimilar⁡equation8
newEquation8≔−1+8⁢x=1+4⁢x−1
solve⁡newEquation8
54,14
Trig equations in forms that can be solved without a calculator produce trig equations that can be solved without a calculator.
equation9≔cos⁡x2+cos⁡x=0
solve⁡equation9
π,π2
newEquation9≔GenerateSimilar⁡equation9
newEquation9≔3−cos⁡7⁢x+42−cos⁡7⁢x+4⁢32=3
solve⁡newEquation9
−47+5⁢π42,−47+π14
equation10≔cos⁡x2+cos⁡x=sin⁡x2
solve⁡equation10
π,π3
newEquation10≔GenerateSimilar⁡equation10
newEquation10≔5⁢cos⁡6⁢x−22−3=−sin⁡6⁢x−22
solve⁡newEquation10
13+π24,13+π8
equation11≔cos⁡x+sin⁡x=0
solve⁡equation11
−π4
newEquation11≔GenerateSimilar⁡equation11
newEquation11≔cos⁡x+6=sin⁡x+6
solve⁡newEquation11
−6+π4
Logarithmic equations that are easily solvable without a calculator return logarithmic equations that can be easily solved without a calculator.
equation12≔ln⁡x−1+ln⁡2⁢x−1=2⁢ln⁡x+1
solve⁡equation12
5
newEquation12≔GenerateSimilar⁡equation12
newEquation12≔ln⁡2⁢x2+7⁢x+16=2⁢ln⁡x+4
solve⁡newEquation12
0,1
equation13≔%log3⁡x−1+%log3⁡2⁢x−1=2⁢%log3⁡x+1
equation13≔log3⁡x−1+log3⁡2⁢x−1=2⁢log3⁡x+1
solve⁡InertForm:-Value⁡equation13
newEquation≔GenerateSimilar⁡equation13
newEquation≔log4⁡−13⁢x+4=2⁢log4⁡x−2
solve⁡newEquation13
Exponential equations that can be easily solved without a calculator return exponential equations that can be easily solved without a calculator.
equation14≔exp⁡cos⁡x2=exp⁡−cos⁡x⁢exp⁡sin⁡x2
equation14≔ⅇcos⁡x2=ⅇ−cos⁡x⁢ⅇsin⁡x2
solve⁡equation14
π,π3,−π3
newEquation14≔GenerateSimilar⁡equation14
newEquation14≔ⅇ−2⁢cos⁡2⁢x+32−2⁢sin⁡2⁢x+32−4⁢cos⁡2⁢x+3−1=ⅇ2⁢cos⁡2⁢x+3+2⁢ⅇ2⁢cos⁡2⁢x+32−3⁢cos⁡2⁢x+3−4
solve⁡newEquation14
−32+π2,−32+π3
Complex polynomial equations with roots that have integer real and imaginary parts produce complex polynomial equations with integer real and imaginary roots.
equation15≔z2+−9+4⁢I⁢z+4−18⁢I=0
solve⁡equation15
8−2⁢I,1−2⁢I
newEquation15≔GenerateSimilar⁡equation15
newEquation15≔−z2+9⁢z−I⁢z+8+21⁢I=0
solve⁡newEquation15
−1−2⁢I,10+I
Absolute value equations produce absolute value equations.
equation16≔abs⁡x−3=abs⁡5−3⁢x
equation16≔x−3=3⁢x−5
solve⁡equation16
2,1
newEquation16≔GenerateSimilar⁡equation16
newEquation16≔3⁢x=x+4
solve⁡newEquation16
−1,2
equation17≔abs⁡x2+2⁢x=15
equation17≔x2+2⁢x=15
solve⁡equation17
−5,3
newEquation17≔GenerateSimilar⁡equation17
newEquation17≔x2−14⁢x+33=12
solve⁡newEquation17
7−2⁢7,7+2⁢7,5,9
Equations of circles return equations of circles.
equation18≔x−32+y+42=16
plots:-implicitplot⁡equation18,x=−20..20,y=−20..20
newEquation18≔GenerateSimilar⁡equation18
newEquation18≔x−92+y+102=25
plots:-implicitplot⁡newEquation18,x=−20..20,y=−20..20
Equations of ellipses return equations of ellipses.
equation19≔x−224+y+329=1
plots:-implicitplot⁡equation19,x=−20..20,y=−20..20
newEquation19≔GenerateSimilar⁡equation19
newEquation19≔x−32100+y+1249=1
plots:-implicitplot⁡newEquation19,x=−20..20,y=−20..20
Equations of hyperbolas return equations of hyperbolas.
equation20≔x−224−y+5216=1
plots:-implicitplot⁡equation20,x=−20..20,y=−20..20
newEquation20≔GenerateSimilar⁡equation20
newEquation20≔x−102100−y+8281=1
plots:-implicitplot⁡newEquation20,x=−20..20,y=−20..20
Probability of measuring less than a certain amount of successes from a binomial distribution.
GenerateSimilar⁡%sum⁡8!8−x!⁢x!⁢14x⁢348−x,x=0..4
∑x=07⁡5040⁢310x⁢7107−x7−x!⁢x!
Probability of measuring more than a certain amount of successes from a binomial distribution.
GenerateSimilar⁡%sum⁡8!8−x!⁢x!⁢14x⁢348−x,x=4..8
∑x=24⁡24⁢67x⁢174−x4−x!⁢x!
Expectation value of a binomial distribution.
GenerateSimilar⁡%sum⁡x⁢8!8−x!⁢x!⁢14x⁢348−x,x=0..8
∑x=05⁡120⁢25x⁢35−x+5⁢x−x+5!⁢x!
Probability of measuring an event of a poisson distribution within a certain amount of time.
GenerateSimilar⁡%sum⁡exp⁡−5⁢5xx!,x=0..10
∑x=058⁡ⅇ−4⁢4xx!
Probability of not measuring an event of a poisson distribution within a certain amount of time.
GenerateSimilar⁡%sum⁡exp⁡−5⁢5xx!,x=10..∞
∑x=69∞⁡ⅇ−4⁢4xx!
Expectation value of a poisson distribution.
GenerateSimilar⁡%sum⁡x⁢exp⁡−5⁢5xx!,x=0..∞
∑x=0∞⁡ⅇ−6⁢6x⁢xx!
Probability of measuring the time between poisson events to be less than a certain value.
GenerateSimilar⁡%int⁡5⁢exp⁡−5⁢x,x=0..10
∫0374⁢ⅇ−4⁢xⅆx
Probability of measuring the time between poisson events to be more than a certain value.
GenerateSimilar⁡%int⁡5⁢exp⁡−5⁢x,x=10..∞
∫52∞8⁢ⅇ−8⁢xⅆx
Expectation value of an exponential distribution.
GenerateSimilar⁡%int⁡x⋅5⁢exp⁡−5⁢x,x=0..∞
∫0∞6⁢ⅇ−6⁢x⁢xⅆx
Probability of measuring less than a certain value for a gaussian distribution.
GenerateSimilar⁡%int⁡1%sqrt⁡2⁢π⋅2⁢exp⁡−x−428,x=−∞..0
∫−∞0ⅇ−x−22987⁢2⁢πⅆx
Probability of measuring more than a certain value for a gaussian distribution.
GenerateSimilar⁡%int⁡1%sqrt⁡2⁢π⋅2⁢exp⁡−x−428,x=0..∞
∫0∞ⅇ−x−6220010⁢2⁢πⅆx
Expectation value of a gaussian distribution.
GenerateSimilar⁡%int⁡x%sqrt⁡2⁢π⋅2⁢exp⁡−x−428,x=−∞..∞
∫−∞∞ⅇ−x−6232⁢x4⁢2⁢πⅆx
Parametrization of a circle returns a parametrization of a circle.
plot⁡2⁢cos⁡t−4,2⁢sin⁡t+1,t=0..2⁢π
newCircle≔GenerateSimilar⁡2⁢cos⁡t−4,2⁢sin⁡t+1
newCircle≔cos⁡9⁢t−8−sin⁡9⁢t+7
plot⁡newCircle1,newCircle2,t=0..2⁢π
Parametrization of an ellipse returns a parametrization of an ellipse.
plot⁡2⁢cos⁡t−4,3⁢sin⁡t+1,t=0..2⁢π
newEllipse≔GenerateSimilar⁡2⁢cos⁡t−4,3⁢sin⁡t+1
newEllipse≔7⁢cos⁡5⁢t−64⁢sin⁡5⁢t+8
plot⁡newEllipse1,newEllipse2,t=0..2⁢π
Parametrization of a cycloid returns a parametrization of a cycloid.
plot⁡10⁢t−5⁢sin⁡t,5−5⁢cos⁡t,t=0..4⁢π
newCycloid≔GenerateSimilar⁡5⁢t−5⁢sin⁡t,5−5⁢cos⁡t
newCycloid≔−27⁢t+3⁢sin⁡9⁢t3−3⁢cos⁡9⁢t
plot⁡newCycloid1,newCycloid2,t=0..π
The RandomTools[GenerateSimilar] command was introduced in Maple 2020.
For more information on Maple 2020 changes, see Updates in Maple 2020.
See Also
HowDoI,WorkWithRandomGenerators
InertForm
rand
RandomTools[Generate]
RandomTools[GenerateSimilarODE]
randpoly
Download Help Document