Analytical Solution to Riemann problem, Solve function gives troubles

Hello community,
Regarding some larger numerical scheme I want have to solve the analytical solution to a Dam-break or mathematically known as Riemann problem. Actually to help me I think it's not even important to understand the problem as I have only troubles with the solve or also linsolve funtion of Matlab. Attached you can see the code, Why do I not get a solution (or several)???
if true
y1=1;
y2=0.1;
q1=0;
q2=0;
g=9.81;
syms s yu qu
[solv, solu, soll] = solve([(qu/yu)+2*sqrt(g*yu)-(2*sqrt(g*y1))==0, (s*(y2-yu))-(q2-qu)==0,0==((q2^2)/y2+g*(y2^2)/2)-((qu^2)/yu+g*(yu^2)/2)-(s*(q2-qu))], [s yu qu]);
%A = [(qu/yu)+2*sqrt(g*yu)-(2*sqrt(g*y1)); (s*(y2-yu))-(q2-qu);((q2^2)/y2+g*(y2^2)/2)-((qu^2)/yu+g*(yu^2)/2)-(s*(q2-qu))];
%B = [0;0;0];
%linsolve(A,B)
end

Answers (1)

There are 4 solutions, each involving a different root of a 6th order polynomial. There is no closed form for the roots of that polynomial. Two of the roots lead to real-valued solutions and the other two lead to complex-valued solutions. The real-valued solutions are
{qu = 0.8017043628e-2, s = -0.8124961782e-1, yu = 0.1328229699e-2}
{qu = .9196623900, s = 3.105133650, yu = .3961748167}
You do not indicate what problems you encountered with solve(). There is a hint that you might not have received any solutions; if so then it might be a consequence of the 6th order polynomial. Some of the older versions of the symbolic toolbox failed sometimes on polynomials of degrees greater than 4.
The 6th order polynomial which gets repeated in the solutions is 1000*Z^6-900*Z^4+1600*Z^3-810*Z^2+1

1 Comment

hey walter, so i understood correctly that you just copied my code and got the solutions? I recieve solutions but they are always 0 or an empty symvar variable, as if the code just stopped running... how could i update my toolbox ?

Sign in to comment.

Categories

Find more on Mathematics in Help Center and File Exchange

Asked:

on 15 May 2015

Commented:

on 15 May 2015

Community Treasure Hunt

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

Start Hunting!