MATLAB Answers

system of 4 symbolic equations, one unknown and can't get a numerical value or symbolic expression for this unknown

1 view (last 30 days)
petit
petit on 16 Apr 2021
I have a system of 4 symbolic equations, actually these come from the equality between 2 matrixes 2x2. I have only one unknown which appears multiple times in the system of equations
The system seems to be solved but I don't know how to get a numerical value of this unknown or maybe a simple symbolic expression of it.
I put below all the Matlab script, you can run it, I think it should not generate errors :
clear;
clc;
format long;
% 2 Fisher Matrixes symbolic : FISH_GCsp_SYM, FISH_XC_SYM
% GCsp Fisher
FISH_GCsp_SYM = sym('sp1_', [2,2], 'real');
% Force symmetry for GCsp
FISH_GCsp_SYM = tril(FISH_GCsp_SYM.') + triu(FISH_GCsp_SYM,1)
% XC Fisher
FISH_XC_SYM = sym('xc1_', [3,3], 'real');
% Force symmetry for GCph
FISH_XC_SYM = tril(FISH_XC_SYM.') + triu(FISH_XC_SYM,1)
% Brutal Common
FISH_ALL1 = sym('xc1_', [2,2], 'real');
% Summing
FISH_ALL1(1:2,1:2) = FISH_GCsp_SYM(1:2,1:2) + FISH_XC_SYM(1:2,1:2);
% Force symmetry
FISH_ALL1 = (tril(FISH_ALL1.') + triu(FISH_ALL1,1));
% Adding new observable "O" terms
FISH_O_SYM = sym('o_', [2,2], 'real');
% Defining symbolic bias for "O" terms
FISH_BIAS_SYM = sym('b_', [2], 'real');
% Definition of F_ij = Matrix for adding elements
FISH_O_SYM(1,1) = 4*FISH_BIAS_SYM(1)^2/FISH_BIAS_SYM(2)^4
FISH_O_SYM(2,2) = 4*FISH_BIAS_SYM(1)^4/FISH_BIAS_SYM(2)^6
FISH_O_SYM(1,2) = -4*FISH_BIAS_SYM(1)^3/FISH_BIAS_SYM(2)^5
% Definition of sigma_o
SIGMA_O = sym('sigma_o', 'real');
FISH_O_SYM = 1/(SIGMA_O*SIGMA_O) * FISH_O_SYM
% Force symmetry
FISH_O_SYM = (tril(FISH_O_SYM.') + triu(FISH_O_SYM,1))
% Second on right Fisher matrix : Big Fisher on right
FISH_SYM = sym('xc1_', [4,4], 'real');
% Param cosmo
FISH_SYM(1,1) = FISH_GCsp_SYM(1,1) + FISH_XC_SYM(1,1);
% Add O observable
FISH_SYM(2,2) = FISH_SYM(2,2) + FISH_O_SYM(1,1);
FISH_SYM(3,3) = FISH_SYM(3,3) + FISH_O_SYM(2,2);
FISH_SYM(2,3) = FISH_SYM(2,3) + FISH_O_SYM(1,2);
FISH_SYM(3,2) = FISH_SYM(3,2) + FISH_O_SYM(2,1);
% Introduce spectro off-diagonal for column/raw 2
FISH_SYM(1,2) = FISH_GCsp_SYM(1,2) + FISH_XC_SYM(1,2);
FISH_SYM(2,1) = FISH_GCsp_SYM(2,1) + FISH_XC_SYM(2,1);
% Force symmetry
FISH_SYM = (tril(FISH_SYM.') + triu(FISH_SYM,1));
% Marginalize
% Invert to marginalyze
COV_ALL = inv(FISH_SYM);
% Marginalize
COV_ALL([3,4],:) = [];
COV_ALL(:,[3,4]) = [];
FISH_ALL2 = inv(COV_ALL);
% Matricial equation to solve
eqn = FISH_ALL1 == FISH_ALL2;
% Solving : SIGMA_O = sigma_o
[solx, parameters, conditions] = solve(eqn, SIGMA_O, 'ReturnConditions', true);
assume(conditions)
restriction = [solx > 0];
solk = solve(restriction,parameters)
valx = subs(solx,parameters,solk)
As you can see, the only unknow is called `SIGMA_O = sigma_o` as symbolic variable in the code.
The issue comes from the last line, that is to say :
assume(conditions)
restriction = [solx > 0];
solk = solve(restriction,parameters)
valx = subs(solx,parameters,solk)
I have followed the procedure from https://fr.mathworks.com/help/symbolic/solve.html
Indeed, the line `solk` and `valk` don't produce any values whereas the system can be solved under conditions.
I have set a restriction `solx > 0` since **sigma_o represents a standard deviation**.
I need help to get at least a symbolic expression or even a numerical value would be great (but I am not sure that we can get a numerical value from one only unknown in a system of multiple equations.
Surely there is a degeneracy with this single unknown `sigma_o`, that's why I would be able to select on physical criteria "good" or "acceptable" values.
Any clue/suggestion/track is welcome

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!