Robert Israel

6577 Reputation

21 Badges

18 years, 215 days
University of British Columbia
Associate Professor Emeritus
North York, Ontario, Canada

MaplePrimes Activity


These are replies submitted by Robert Israel

I didn't mean to sound offended. You were the one who mentioned "doodling around". 'Look up "separable"' was intended as a serious hint. 'Do it the way your instructor wants you to' is also advice worth taking: if these are homework questions intended to be solved using pen and paper, then you should learn how to do them with pen and paper. You can use Maple to check your work, and to solve problems that are difficult for pen-and-paper methods.
I didn't mean to sound offended. You were the one who mentioned "doodling around". 'Look up "separable"' was intended as a serious hint. 'Do it the way your instructor wants you to' is also advice worth taking: if these are homework questions intended to be solved using pen and paper, then you should learn how to do them with pen and paper. You can use Maple to check your work, and to solve problems that are difficult for pen-and-paper methods.
Yes, it is indeed possible that LinearSolve returns a solution with no parameters. That means that there is exactly one way to write your vector as a linear combination of the other vectors with coefficients adding up to 1. If that linear combination has some negative coefficients, it means that your vector is not a convex combination of the other vectors. It is also possible that LinearSolve or LPSolve returns no solution, which again means that it is not a convex combination of the other vectors. Since LPSolve is using numerical methods, there is also the possibility of roundoff error, which in some cases (especially if there are large numbers involved) might result in wrong answers. If your original vectors have rational entries, you might try using the simplex package instead, which uses exact rational arithmetic rather than floating point.
Yes, it is indeed possible that LinearSolve returns a solution with no parameters. That means that there is exactly one way to write your vector as a linear combination of the other vectors with coefficients adding up to 1. If that linear combination has some negative coefficients, it means that your vector is not a convex combination of the other vectors. It is also possible that LinearSolve or LPSolve returns no solution, which again means that it is not a convex combination of the other vectors. Since LPSolve is using numerical methods, there is also the possibility of roundoff error, which in some cases (especially if there are large numbers involved) might result in wrong answers. If your original vectors have rational entries, you might try using the simplex package instead, which uses exact rational arithmetic rather than floating point.
If you want to multiply the Matrix M times the column Vector v, it's
> M . v;
If you want to multiply the row Vector w times the Matrix M, it's
> w . M;
If you want to multiply the Matrix M times the column Vector v, it's
> M . v;
If you want to multiply the row Vector w times the Matrix M, it's
> w . M;
Rather than doodling around, look up "separable" in your textbook and do it the way your instructor wants you to.
Rather than doodling around, look up "separable" in your textbook and do it the way your instructor wants you to.
I think you are answering the wrong question. {1,25,32,34} would be A minus B.
I think you are answering the wrong question. {1,25,32,34} would be A minus B.
The first problem is that you're using 2D input, which often makes it hard to tell what exactly is going on. Also there seems to be some problem with some of the definitions in the "Propriété de la simulation" section, as Maple complained to me about missing operations. The second problem is that you're trying to use S as a function (although you only defined S(z)), and also as a table (by defining S[b] and S[g]). I fixed that by defining S as
> S:= z -> Pi*sqrt(40*z+1); 
and using S_b and S_g instead of S[b] and S[g]. Similarly I used m_e, m_f, v_ini, u_ini, vol_ini, m_ini, t_max. Now
> F:= unapply(int(1/S(z),z),z);
F:= z -> 1/20*(40*z+1)^(1/2)/Pi and you can use that for the integral in your equation e5. It's unlikely that your system will have a closed form solution, but numerical solution methods should work. I assume the initial conditions are H(0)=H_ini, ..., vol(0) = vol_ini. Then everything would work except that you haven't given a value to rho in equation eq4. I'll take rho = 1. So here's the completed code:
> g:= 9.81:
gam := 1.4:
C[x]:= 0.4:
dt := 0.0005:
t_max:= 100:
m_f := 0.250:
m_e := 1.2:
P[a]:= 101300:
rho[e]:= 1000:
rho[a]:= 1.3:
P[ini]:= 600000:
v_ini := 0:
a[ini]:= 0:
u_ini:= 0:
vol_ini:= 0.001:
m_ini:= m_e + m_f:
S := z -> Pi*sqrt(40*z+1):
S_b:= S(30*10^(-2)):
S_g:= S(0):
H_ini:= 0.20:
F:= unapply(int(1/S(z),z),z);
eq1:= diff(m(t),t) = -rho[e]*S_g*u(t);
eq2:= diff(vol(t),t) = -S_g*u(t);
eq3:= diff(H(t),t) = S_g/S_b*u(t);
eq4:= diff(v(t),t) = 1/m(t)*(rho[a]*S_g*u(t)^2 - C[x]*rho[a]*S_b*v(t)^2/2 
- rho * S_g*(H(t)*diff(u(t),t)+ S_g/S_b * u(t)^2) - g);
eq5:= diff(u(t),t)*S_b*(F(H(t))-F(0)) + 1/2*((S_g/Pi/sqrt(40*H(t)+1))^2-1)*u(t)^2 
+ P[a]/rho[e]+(diff(v(t),t)+g)*H(t)=0;
sys:= eq1,eq2,eq3,eq4,eq5:
ics:= H(0) = H_ini, u(0) = u_ini, m(0) = m_ini, v(0) = v_ini, vol(0) = vol_ini;
rho:= 1; 
Sol:= dsolve({sys, ics}, {H(t),u(t),m(t),v(t),vol(t)},numeric);
Unfortunately, I suspect there may be a mistake in at least one of these equations, because:
> Sol(0.07);
[t = 0.7e-1, H(t) = 0.286223629405818330e-1, m(t) = 1942.67421170670150, u(t) = -16.2633993231012824, v(t) = .370794674266127722, vol(t) = 1.94222421170670145] which doesn't make much sense physically: water seems to be coming in to the rocket rather than going out.
The first problem is that you're using 2D input, which often makes it hard to tell what exactly is going on. Also there seems to be some problem with some of the definitions in the "Propriété de la simulation" section, as Maple complained to me about missing operations. The second problem is that you're trying to use S as a function (although you only defined S(z)), and also as a table (by defining S[b] and S[g]). I fixed that by defining S as
> S:= z -> Pi*sqrt(40*z+1); 
and using S_b and S_g instead of S[b] and S[g]. Similarly I used m_e, m_f, v_ini, u_ini, vol_ini, m_ini, t_max. Now
> F:= unapply(int(1/S(z),z),z);
F:= z -> 1/20*(40*z+1)^(1/2)/Pi and you can use that for the integral in your equation e5. It's unlikely that your system will have a closed form solution, but numerical solution methods should work. I assume the initial conditions are H(0)=H_ini, ..., vol(0) = vol_ini. Then everything would work except that you haven't given a value to rho in equation eq4. I'll take rho = 1. So here's the completed code:
> g:= 9.81:
gam := 1.4:
C[x]:= 0.4:
dt := 0.0005:
t_max:= 100:
m_f := 0.250:
m_e := 1.2:
P[a]:= 101300:
rho[e]:= 1000:
rho[a]:= 1.3:
P[ini]:= 600000:
v_ini := 0:
a[ini]:= 0:
u_ini:= 0:
vol_ini:= 0.001:
m_ini:= m_e + m_f:
S := z -> Pi*sqrt(40*z+1):
S_b:= S(30*10^(-2)):
S_g:= S(0):
H_ini:= 0.20:
F:= unapply(int(1/S(z),z),z);
eq1:= diff(m(t),t) = -rho[e]*S_g*u(t);
eq2:= diff(vol(t),t) = -S_g*u(t);
eq3:= diff(H(t),t) = S_g/S_b*u(t);
eq4:= diff(v(t),t) = 1/m(t)*(rho[a]*S_g*u(t)^2 - C[x]*rho[a]*S_b*v(t)^2/2 
- rho * S_g*(H(t)*diff(u(t),t)+ S_g/S_b * u(t)^2) - g);
eq5:= diff(u(t),t)*S_b*(F(H(t))-F(0)) + 1/2*((S_g/Pi/sqrt(40*H(t)+1))^2-1)*u(t)^2 
+ P[a]/rho[e]+(diff(v(t),t)+g)*H(t)=0;
sys:= eq1,eq2,eq3,eq4,eq5:
ics:= H(0) = H_ini, u(0) = u_ini, m(0) = m_ini, v(0) = v_ini, vol(0) = vol_ini;
rho:= 1; 
Sol:= dsolve({sys, ics}, {H(t),u(t),m(t),v(t),vol(t)},numeric);
Unfortunately, I suspect there may be a mistake in at least one of these equations, because:
> Sol(0.07);
[t = 0.7e-1, H(t) = 0.286223629405818330e-1, m(t) = 1942.67421170670150, u(t) = -16.2633993231012824, v(t) = .370794674266127722, vol(t) = 1.94222421170670145] which doesn't make much sense physically: water seems to be coming in to the rocket rather than going out.
I don't know how to get Excel to do it by itself: MaplePrimes is a site for Maple, not for Excel. For instructions on how to use Maple as an add-in to Excel, allowing Excel to access Maple commands, see the (Maple) help page ?Excel.
I don't know how to get Excel to do it by itself: MaplePrimes is a site for Maple, not for Excel. For instructions on how to use Maple as an add-in to Excel, allowing Excel to access Maple commands, see the (Maple) help page ?Excel.
To find the inverse of x mod y, where x is in cell A1 and y in A2:
=Maple("1/&1 mod &2",A1,A2)
First 157 158 159 160 161 162 163 Last Page 159 of 187