1
$\begingroup$

I am a newbie in Mathematica, but I need to create a random univariate polynomial of degree d with complex coefficients whose entries are random complex variables with real and imaginary parts being independent distributions with mean value = 1 and variance = 2.

$\endgroup$
3
  • $\begingroup$ See for example RandomVariate, Dot and Array or FromCoefficientRules $\endgroup$ Oct 15, 2015 at 16:57
  • $\begingroup$ Also, FromDigits[]. $\endgroup$ Oct 15, 2015 at 17:02
  • $\begingroup$ Greetings! To make the most of Mma.SE please take the tour now. Help us to help you, write an excellent question. Edit if improvable, show due diligence, give brief context, include minimum working examples of code and data in formatted form. As you receive give back, vote and answer questions, keep the site useful, be kind, correct mistakes and share what you have learned. $\endgroup$
    – rhermans
    Oct 15, 2015 at 17:29

2 Answers 2

1
$\begingroup$

Using FromDigits as suggested by J.M.

f[d_Integer, var_Symbol] := ExpandAll@FromDigits[
   (#1 + #2 I) & @@@ Transpose[{
      RandomVariate[NormalDistribution[1, Sqrt[2]], d]
      , RandomVariate[GammaDistribution[1/2, 2], d]
      }], var]

Mathematica graphics

To figure out parameters of GammaDistribution

{α, β} /. 
 First@Solve[{Variance[GammaDistribution[α, β]] == v, 
    Mean[GammaDistribution[α, β]] == 
     m}, {α, β}]
 {m^2/v, v/m}
$\endgroup$
4
$\begingroup$

Just post anothor method about building a polynomial,and the coefficients you can use the @rhermans 's solution to produce.

list = RandomComplex[{-2 - I, 5 + 3 I}, 3]
(*{1.83992 + 1.75346 I,3.79133 + 1.05147 I, -0.0638321 - 0.551983 I}*)

AlgebraicNumber[x, list]
(*(1.83992 +1.75346 I) + (3.79133 + 1.05147 I) x - (0.0638321 + 0.551983 I) x^2*)
$\endgroup$
1
  • $\begingroup$ +1 for AlgebraicNumber $\endgroup$
    – rhermans
    Oct 16, 2015 at 7:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.