Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Solve a system of equations with constraints

    Hi,

    I am trying to solve a system of equations of the form :

    Code:
    Ai = Bi [Xi - Sum {Bi*Xi}]
    where we need to solve for Xi given that Ai and Bi are known numbers for i=1,2...30 and Sum is the summation operator, with constraints : 1) Sum of Bi=30 and 2) Sum of Xi=1

    I am trying to use the procedure described in https://www.stata.com/support/faqs/p...ear-equations/, but I have 30 equations here. Is there a simple way to code this in Mata.

    Any help is much appreciated.

    Thank you

  • #2
    Have you tried mm_root() function from the moremata package
    Code:
    ssc install moremata
    Regards
    --------------------------------------------------
    Attaullah Shah, PhD.
    Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
    FinTechProfessor.com
    https://asdocx.com
    Check out my asdoc program, which sends outputs to MS Word.
    For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

    Comment

    Working...
    X