Please bear with me as I am a beginner at Mathematica.

In the following system, all variables on the right hand side are known, except for w1, w2 and w3, for which we are trying to solve. enter image description here

I am trying to solve this system in Mathematica, but I am not sure where to start. Also, in my real example, the system is composed of 10 equations instead of three: we are trying to solve for w1, w2 and w3 where FA = FB = FC = FD = .... = Fj.

Please let me know if the explanation is a bit confusing, and I will try to explain better! Thanks!

  • 4
    $\begingroup$ You will have to post actual Mathematica code for readers to have much chance of offering assistance. $\endgroup$ Jun 19, 2014 at 19:53
  • $\begingroup$ Sure, I will try doing that soon. Thanks. $\endgroup$
    – Mayou
    Jun 19, 2014 at 20:13
  • $\begingroup$ Please note that the numerator results in scalar quantity (1x3.3x3.3.1=1x1). you can not equate vector quantity {FA,FB,FC} with scalar quantity. $\endgroup$ Jun 19, 2014 at 20:53
  • $\begingroup$ @Algohi Yes you are right. There is a typo.. I will fix this $\endgroup$
    – Mayou
    Jun 19, 2014 at 21:01
  • 1
    $\begingroup$ Just type out the equation(s) in plain ascii. I doubt anyone will want to enter, from scratch, what you've shown in an image. But readers might be willing to convert actual ascii equations, that can be cut and pasted, into proper Mathematica syntax. $\endgroup$ Jun 20, 2014 at 15:13

2 Answers 2


This will show you how to write the equations. Execute each step to see the result

sigma = Thread[Subscript[σ, {A, B, C}]]

(cov = Outer[Times, sigma, sigma] /.
    Subscript[σ, x_] * Subscript[σ, y_] :>
     Subscript[σ, x] * Subscript[σ, y]  * 
      Subscript[ρ, ToString[x] <> ToString[y]]) // MatrixForm

weights = Thread[Subscript[w, Range[3]]]

(m = Table[Subscript[β, i]^j, 
       {j, {A, B, C}}, {i, 3}].weights) //

denom = (Total[
      Table[Subscript[w, n]*Subscript[σ, n], {n, 3}]]^2 //
    Expand) /. 
  Subscript[σ, x_] * Subscript[σ, y_] :>
   Subscript[σ, x] * Subscript[σ, y]  * 
    Subscript[ρ, Sequence[x, y]]

f = Thread[Subscript[F, {A, B, C}]]

eqns = Thread[f == cov.m/denom];

constraints = {Total[weights] == 1, Equal @@ (m.f)}

sol = Solve[Join[eqns, constraints], weights]

This last statement will not be solved in any reasonable amount of time (ever?). However, if the "known" values are given numeric values it might be doable.

sol = With[{***"assign numeric values here"***}, 
  Solve[Join[eqns, constraints], weights]]
  • $\begingroup$ I can't thank you enough for this! $\endgroup$
    – Mayou
    Jun 20, 2014 at 17:01
  • $\begingroup$ Note with a little manipulation the denom quantity can be eliminated from the system. If you do that Solve will have an easier time of it. (Still highly unlikely to get a symbolic solution, but given all the symmetry it is worth a shot. ) $\endgroup$
    – george2079
    Jun 20, 2014 at 17:54
  • $\begingroup$ Actually all the known values have a numerical value assigned to them, so it is definitely solvable! $\endgroup$
    – Mayou
    Jun 20, 2014 at 19:36

This is simple way of writing the equations

Though no solution is found.

enter image description here

if you want to use the symbols as seen the image you can use the Mathematica Palettes which you can find at the main menu.

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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