You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
Whenever I type in syms x and run it, Matlab seems like it's being looped and I also can't stop it. How do I fix it?
6 views (last 30 days)
Show older comments
I always need to use task manager to stop Matlab because pressing X doesn't shut it down.The problem just started today and I don't now why it keeps happening.
Accepted Answer
Steven Lord
on 5 May 2018
18 Comments
Jasper Chan
on 7 May 2018
First of all I just want to say that its ridiculous that the solution to such a fundamental problem is "pay for the newer version of matlab", but I digress.
I've updated to R2018a. I'm not quite sure what R2018a Update 1 means, but the 'Check for Updates' window lists both MATLAB and the Symbolic toolbox as up to date, yet my problem still persists.
>> syms x
Error using mupadmex
Internal error with symbolic engine. Quit and restart MATLAB.
Error in sym>tomupad (line 1219)
S = mupadmex(numeric2cellstr(x));
Error in sym (line 211)
S.s = tomupad(x);
Error in syms (line 201)
toDefine = sym(zeros(1, 0));
Walter Roberson
on 7 May 2018
Dishank Mittal
on 20 May 2018
I was facing the same issue and trying to figure from 2 days. It worked finally. Thanks Walter! Cheers!
Vinayak Vadlamani
on 27 Jun 2018
Edited: Walter Roberson
on 27 Jun 2018
Steven, I tried the fix but it doesn't seem to work. Made the 2017b update. I run LabView in parallel on this system FYI.
System Info (ver)
-----------------------------------------------------------------------------------------------------
MATLAB Version: 9.3.0.713579 (R2017b)
MATLAB License Number: ••••••••
Operating System: Microsoft Windows 10 Enterprise Version 10.0 (Build 17134)
Java Version: Java 1.8.0_121-b13 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
Steven Lord
on 27 Jun 2018
According to the output of the ver function that you posted you have not installed the update. I just installed the update in my installation of release R2017b and the first two lines of my ver output are:
>> ver
--------------------------------------------------
MATLAB Version: 9.3.0.867777 (R2017b) Update 7
[I trimmed some of the dashes in the divider, otherwise this post would have scroll bars.]
Filipe Lima
on 17 Jul 2018
>> ver
-----------------------------------------------------------------------------------------------------
MATLAB Version: 9.4.0.813654 (R2018a)
MATLAB License Number: STUDENT
Operating System: Microsoft Windows 10 Pro Version 10.0 (Build 17134)
Java Version: Java 1.8.0_144-b01 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
I have the latest version but the problem persists!
Steven Lord
on 17 Jul 2018
You don't have the update installed. If you did, the MATLAB Version line would include "Update" and a number after the "(R2018a)".
Open the Bug Report link and click on the "R2018a Update 1" link in the Bug Report. [That now goes to a later update than Update 1, but the later updates include all the bug fixes from previous updates for that release.] Download and install the update.
GAGANDEEP KAUR
on 3 Nov 2020
Edited: Walter Roberson
on 4 Nov 2020
I have updated the version for R2018a but is still hving issue with the syms command , keep on running the code and not showing any result.Please if I could get some help
Here is the section I am having trouble with
syms a b c d e;
K1=zeros(1,5);K2=zeros(1,5);K3=zeros(1,5);K4=zeros(1,5);K5=zeros(1,5);
for i=1:9
%calculating mole fractions of ionic species
x1=[0.5096 0.5092 0.5087 0.4852 0.4847 0.4834 0.4804 0.4805 0.4803];
x2=[0.0963 0.0964 0.0965 0.1163 0.1161 0.1158 0.1275 0.1266 0.1253];
x3=[0.3941 0.3944 0.3948 0.3985 0.3992 0.4008 0.3921 0.3929 0.3943];
T=[394.15 399.15 404.15 375.15 390.15 405.15 374.15 392.15 406.15];
%Equilibrium constant for reaction 1 (Solvation reaction)
K1(i)=exp((-8.549)+(6692/T(i)))
%Equilibrium constant for reaction 2(Ionization of water)
K2(i)=100
%Equilibrium constant for reaction 3(Dissociation of HI)
K3(i)=exp((16.93565)+((1250)/T(i))+(-2.575*log(T(i))))
%Equilibrium constant for reaction 4(Polyiodide formation a)
K4(i)=exp((-936.28)+((40216.27)/T(i))+(151.983*(log(T(i))))+(-0.1675*(T(i))))
%Equilibrium constant for reaction 5(Polyiodide formation b)
K5(i)=exp((1044.78)+(-45171.42/T(i))+(-165.20*log(T(i)))+(0.1511*(T(i))))
eqns=[((d*(c-e))/((x1(i)-a-b-c-d)^5)*(x2(i)-d-b-c))==K1(i),((a+b+c)*a)/((x1(i)-a-b-c-d)^2)==K2(i),((a+b+c)*(d+b))/((x1(i)-a-b-c-d)*(x2(i)-d-b-c-e))==K3(i),((a+b+c)*(c-e))/((x1(i)-a-b-c-d)^4*(x2(i)-d-b-c-e))==K4(i), (((e)*(x1(i)-a-b-c-d)^3)/((c-e)*(x3(i)-e)))==K5(i)];
S=solve(eqns,[a,b,c,d,e]);
S.a(S.a<0)=[];
S.b(S.b<0)=[];
S.c(S.c<0)=[];
S.d(S.d<0)=[];
S.e(S.e<0)=[];
S.a=double(S.a)
S.b=double(S.b)
S.c=double(S.c)
S.d=double(S.d)
S.e=double(S.e)
end
Walter Roberson
on 4 Nov 2020
You should re-arrange.
... It will not help... but you should re-arrange.
syms a b c d e;
x1=[0.5096 0.5092 0.5087 0.4852 0.4847 0.4834 0.4804 0.4805 0.4803];
x2=[0.0963 0.0964 0.0965 0.1163 0.1161 0.1158 0.1275 0.1266 0.1253];
x3=[0.3941 0.3944 0.3948 0.3985 0.3992 0.4008 0.3921 0.3929 0.3943];
T=[394.15 399.15 404.15 375.15 390.15 405.15 374.15 392.15 406.15];
N = length(x1);
K1 = zeros(1,N);
K2 = zeros(1,5);
K3 = zeros(1,N);
K4 = zeros(1,N);
K5 = zeros(1,N);
Sout = struct();
for i=1:N
%calculating mole fractions of ionic species
%Equilibrium constant for reaction 1 (Solvation reaction)
K1(i)=exp((-8.549)+(6692/T(i)));
%Equilibrium constant for reaction 2(Ionization of water)
K2(i)=100;
%Equilibrium constant for reaction 3(Dissociation of HI)
K3(i)=exp((16.93565)+((1250)/T(i))+(-2.575*log(T(i))));
%Equilibrium constant for reaction 4(Polyiodide formation a)
K4(i)=exp((-936.28)+((40216.27)/T(i))+(151.983*(log(T(i))))+(-0.1675*(T(i))));
%Equilibrium constant for reaction 5(Polyiodide formation b)
K5(i)=exp((1044.78)+(-45171.42/T(i))+(-165.20*log(T(i)))+(0.1511*(T(i))));
eqns=[((d*(c-e))/((x1(i)-a-b-c-d)^5)*(x2(i)-d-b-c))==K1(i),((a+b+c)*a)/((x1(i)-a-b-c-d)^2)==K2(i),((a+b+c)*(d+b))/((x1(i)-a-b-c-d)*(x2(i)-d-b-c-e))==K3(i),((a+b+c)*(c-e))/((x1(i)-a-b-c-d)^4*(x2(i)-d-b-c-e))==K4(i), (((e)*(x1(i)-a-b-c-d)^3)/((c-e)*(x3(i)-e)))==K5(i)];
S=vpasolve(eqns,[a,b,c,d,e]);
mask = S.a < 0 | S.b < 0 | S.c < 0 | S.d < 0 | S.e < 0;
S.a(mask)=[];
S.b(mask)=[];
S.c(mask)=[];
S.d(mask)=[];
S.e(mask)=[];
Sout(i).a=double(S.a);
Sout(i).b=double(S.b);
Sout(i).c=double(S.c);
Sout(i).d=double(S.d);
Sout(i).e=double(S.e);
disp(Sout(i))
end
Walter Roberson
on 4 Nov 2020
My tests are suggesting that there might not be any positive solution.
Walter Roberson
on 4 Nov 2020
For the first iteration, the closest I can find to a solution so far is
0.00917672806222852 234268.624175873 -4.132761874031 -234268.627565044 5.76374428893838
Yes, this does involve some very negative numbers. When I restrict to positive values, I do not come at all close to a solution.
Walter Roberson
on 4 Nov 2020
It also appears that there might be fairly noticable round-off problems near that location.
GAGANDEEP KAUR
on 4 Nov 2020
Thank you respected Walter Roberson for your effort and time. I may need to reform this system of equations.
GAGANDEEP KAUR
on 4 Nov 2020
I have tried to run the code you suggested once .As you have found problem with negative values so I made it to run without this constraint and it still keep on running. On pausing it showed following message:
Operation terminated by user during mupadengine/evalin (line 123)
In mupadengine/feval (line 182)
[S,err] = evalin(engine,stmt,'message');
In sym/vpasolve (line 172)
sol = eng.feval('symobj::vpasolve',eqns,vars,X0);
In Equilibrium_constant (line 26)
S=vpasolve(eqns,[a,b,c,d,e]);
Walter Roberson
on 4 Nov 2020
That is the expected message when you control-c to stop execution.
vpasolve is either not able to find an answer or takes a very long time to find an answer even when I tell it to start at a position that is pretty close to working (but not quite working.) My searches have not found any solution when I confine the values to +/- 1e6. And definitely not positive values only.
By the way, the equations have a singularity when c==e, leading to +/- infinity.
More Answers (0)
See Also
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)