1

I'm new to SageMath and I'm trying to see how complicated are the problems Sage can provide solutions to. So I tried to see whether Sage could solve identifiability problems. If we have a normal model, it's known that the model is identifiable, meaning that different values for the parameter space lead to different values of the likelihood function.

Now I tried to write a code to see whether Sage could provide me the right answer. Following wikipedia's first example, I wrote:

var('x, mu1, mu2, sigma1, sigma2')
assume(sigma1>0)
assume(sigma2>0)
solve((1/sigma1^2)*(x-mu1)^2 + log(sigma1)==(1/sigma2^2)*(x-mu2)^2+log(sigma2), mu1, sigma1)

Which returns me [ ]. What am I doing wrong? Or can't Sage solve such problems? I believe my mistake is in the statement, defining multiple variables, because if I write

var('x, mu1, mu2, sigma1, sigma2')
assume(sigma1>0)
assume(sigma2>0)
solve((1/sigma1^2)*(x-mu1)^2 + log(sigma1)==(1/sigma2^2)*(x-mu2)^2+log(sigma2), sigma1)

I get:

[sigma1^2 == -(mu1^2*sigma2^2 - 2*mu1*sigma2^2*x + sigma2^2*x^2)/(sigma2^2*log(sigma1) - sigma2^2*log(sigma2) - mu2^2 + 2*mu2*x - x^2)]

Thanks!

  • Asked and at least partially answered at https://ask.sagemath.org/question/58055/solving-equations-in-sagemath/. – John Palmieri Jul 20 '21 at 17:22
  • @JohnPalmieri thank you! I asked the first question there and then decided to ask here in SO because I believe the audience is broader. Please let me know if this is problematic. – YetAnotherUsr Jul 20 '21 at 18:42
  • I have no problems with your post, but I thought I should point out the other thread for context. By the way, the audience here is certainly broader, but in my experience Sagemath questions don't always get much attention here. (It varies depending on the question.) – John Palmieri Jul 20 '21 at 20:32

0 Answers0