New user, help please!!!

16 views (last 30 days)
John
John on 22 May 2013
I keep getting this error using the mupad solver!!
equations:={eqn1,eqn2,...,eqn51}
unknowns:={var1,var2,...,var51}
solve(equations,unknowns)
Error: Illegal variable context [DOM_VAR]; during evaluation of 'solvelib::indets'
What should I do????
  3 Comments
John
John on 22 May 2013
Edited: Walter Roberson on 22 May 2013
system_1:={
yht-z*(gamma^(1/eta)*(lu)^((eta-1)/eta)+(1-gamma)^(1/eta)*(li)^((eta-1)/eta))^(eta/(eta-1))=0,
yft_s-z_s*ld=0,
yht-yh-yh_s=0,
yft_s-yf-yf_s=0,
y-(omega^(1/mu)*yh^((mu-1)/mu)+(1-omega)^(1/mu)*yf^((mu-1)/mu))^(mu/(mu-1))=0,
y_s-(omega_s^(1/mu_s)*yh_s^((mu_s-1)/mu_s)+(1-omega_s)^(1/mu_s)*yf_s^((mu_s-1)/mu_s))^(mu_s/(mu_s-1))=0,
yh-omega*ph^(-mu)*y=0,
yh_s-omega_s*(ph*q^(-1))^(-mu_s)*y_s=0,
yf-(1-omega)*(pf*q)^(-mu)*y=0,
yf_s-(1-omega_s)(pf)^(-mu_s)*y_s=0,
y-cu-ci-kap_u*vu-kap_i*vi=0,
y_s-cd_s-f*wi*q^(-1)*e-kap_d*vd=0,
wu*lu-cu=0,
(1-s)*(1-(ud/d))*wd_s+i*dif-cu_s-f*wi*q^(-1)*e=0,
dif-wi*q^(-1)*(1-(ui/i))+wd_s*(1-(ud/d))=0,
i-li-ui=0,
d-ld-ud=0,
i-(1-delta)*(i+e)=0,
f*wi*q^(-1)-(b*(1-delta))/(1-b*(1-delta))*dif=0,
s-lu-uu=0,
1-s-i-d=0,
mat_u-chi_u*uu^(1-ep_u)*vu^(ep_u)=0,
mat_i-chi_i*ui^(1-ep_i)*vi^(ep_i)=0,
mat_d-chi_d*ud^(1-ep_d)*vd^(ep_d)=0,
qu-mat_u/vu=0,
qi-mat_i/vi=0,
qd-mat_d/vd=0,
pu-mat_u/uu=0,
pi-mat_i/ui=0,
pd-mat_d/ud=0,
theta_u-vu/uu=0,
theta_i-vi/ui=0,
theta-d-vd/ud=0,
lu-(1-lam_u)*lu-mat_u=0,
li-(1-lam_i)*(1-delta)*li-mat_i=0,
ld-(1-lam_d)*ld-mat_d=0,
phi_u-b*(vmpl_u-wu+(1-lam_u)*phi_u)=0,
phi_i-b*(vmpl_i-wi+(1-lam_i)*(1-delta)*phi_i)=0,
phi_d-b*(vmpl_d-wd_s+(1-lam_d)*phi_d)=0,
kap_u-phi_u*qu=0,
kap_i-phi_i*qi=0,
kap_d-phi_d*qd=0,
vmpl_u-ph*z^((eta-1)/eta)*((yht/lu)*gamma)^(1/eta)=0,
vmpl_i-ph*z^((eta-1)/eta)*((yht/li)*(1-gamma))^(1/eta)=0,
vmpl_d-pf*z_s=0,
wi*li-q*r-ci=0,
q^(-1)*ci/i-cd_s/d=0,
cu_s-cd_s-q^(-1)*ci=0,
q-p/p_s=0,
ph-phn/p=0,
pf-pfn/p_s=0
}
vars_1:={
yht,yft_s,lu,li,ld,yh,yh_s,yf,yf_s,q,y,y_s,p,p_s,ph,pf,phn,pfn,cu,ci,cd_s,cu_s,i,d,e,mat_u,mat_i,mat_d,dif,qu,qi,qd,pu,pi,pd,theta_c,theta_i,theta_d,phi_u,phi_i,phi_d,uu,ui,ud,vu,vi,vd,r,vmpl_u,vmpl_i,vmpl_d
};
A:=Dom::Interval(0,1):
assume(omega in A and omega_s in A and f>=0 and s in A and delta in A and b in A and ep_u in A and ep_i in A and ep_d in A and chi_u>0 and chi_i>0 and chi_d>0 and lam_u in A and lam_i in A and lam_d in A and kap_u>=0 and kap_i>=0 and kap_d>=0):
assumeAlso(0<mat_i<=min(ui,vi) and 0<mat_u<=min(uu,vu) and 0<mat_d<=min(ud,vd) and yht>0 and yft_s>0 and z>0 and z_s>0 and lu in Dom::Interval(0,s) and li in Dom::Interval(0,i) and ld in Dom::Interval(0,d) and yh>0 and yh_s>0 and yf>0 and yf_s>0 and y>0 and y_s>0 and p>0 and p_s>0 and ph>0 and pf>0 and phn>0 and pfn>0 and cu>0 and ci>0 and cd_s>0 and cu_s>0 and wu>0 and wi>0 and wd_s>0 and i in Dom::Interval([0],[1-s]) and e<(1-s) and qu in A and qi in A and qd in A and pu in A and pi in A and pd in A and theta_u>0 and theta_i>0 and theta_d>0 and uu in Dom::Interval(0,s) and ui in Dom::Interval(0,i) and ud in Dom::Interval(0,d) and vu>=0 and vi>=0 and vd>=0 and r>=0);
solve(system_1, vars_1, Real);
Error: Illegal variable context [DOM_VAR];
during evaluation of 'solvelib::indets'
Walter Roberson
Walter Roberson on 22 May 2013
You have (e.g.) 0<mat_i<=min(ui,vi) . Experiment with converting those into two-part ranges, such as 0<mat_i and mat_i <= min(ui,vi)

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 22 May 2013
(1-omega_s)(pf) is a function call. You missed a multiplication.
  8 Comments
Walter Roberson
Walter Roberson on 23 May 2013
I ran the system (without assumption) through Maple. I killed it off after 12+ hours of computation. It might be worth taking much smaller subsets of the equations and solving those and seeing how complicated it gets.
Also, places you have expressions such as
qu-mat_u/vu=0,
qi-mat_i/vi=0,
can be handled by removing those from the set of equations, and using (e.g.,)
subs(system_l, qi, mat_i/vi)
That is, if
qi-mat_i/vi=0
then
qi = 0 - (-mat_i/vi)
qi = mat_i/vi
so substitute mat_i/vi for qi in the rest of the expressions.
John
John on 23 May 2013
Right, that's a good thought. My hope was that the assumptions would reduce computation time/number of cases, but perhaps not. I'll let you know if I make any progress. Thanks for all of the help.
- Tristan

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!