Preben Alsholm

13743 Reputation

22 Badges

20 years, 337 days

MaplePrimes Activity


These are replies submitted by Preben Alsholm

@FKil In your worksheet I see the expression (which I shall call w):

w:=evalf(-N/(b*h)+((-EI*(diff(u(x), x, x)))*.5)*h/(0.10e-10*Iice));
#I have used evalf on it to make it shorter
#Collecting w.r.t. F
w1:=collect(w,F);
whattype(w1); #The result is a product
nops(w1); #Two factors
op(2,w1); #One factor is F and the other doesn't contain F:
indets(op(1,w1),name);

So maximizing op(1,w1) (same as maximizing w1 with F=1) gives you a real number (say r), and you want to solve r*F = 1.43e6.


So what is the problem?

@FKil In your worksheet I see the expression (which I shall call w):

w:=evalf(-N/(b*h)+((-EI*(diff(u(x), x, x)))*.5)*h/(0.10e-10*Iice));
#I have used evalf on it to make it shorter
#Collecting w.r.t. F
w1:=collect(w,F);
whattype(w1); #The result is a product
nops(w1); #Two factors
op(2,w1); #One factor is F and the other doesn't contain F:
indets(op(1,w1),name);

So maximizing op(1,w1) (same as maximizing w1 with F=1) gives you a real number (say r), and you want to solve r*F = 1.43e6.


So what is the problem?

@FKil Isn't it as simple as the following or am I misunderstanding something?

sm:=Optimization:-Maximize(eval(-N/(b*h)+((-EI*(diff(u(x), x, x)))*.5)*h/(0.10e-10*Iice), F = 1), x = 0 .. l);
eq:=sm[1]*F=sigma[t];
solve(eq,F);

@FKil Isn't it as simple as the following or am I misunderstanding something?

sm:=Optimization:-Maximize(eval(-N/(b*h)+((-EI*(diff(u(x), x, x)))*.5)*h/(0.10e-10*Iice), F = 1), x = 0 .. l);
eq:=sm[1]*F=sigma[t];
solve(eq,F);

@acer Thanks for the explanation.
A comment:
map(eval,M+K);
does seem to evaluate all elements.

@acer Thanks for the explanation.
A comment:
map(eval,M+K);
does seem to evaluate all elements.

@Divhhh The time is given by the line integral


where s is arclength and v is velocity. From conservation of energy we have
1/2*m*v^2+m*g*y = C = 0 (if v = 0 at y = 0).
Thus v = sqrt(-2*g*y).
If the curve is given parametrically by x = x(u), y = y(u) (avoiding the use of t in order not to get confused), then ds/du = sqrt(x'(u)^2+y'(u)^2). Thus time spent on the curve (with u = 0 .. u0) is given by:

T = int( sqrt(x'(u)^2+y'(u)^2)/sqrt(-2*g*y(u)), u = 0..u0).
In Maple:

restart;
a := 1; b := -1:
g := 9.81:
eq1 := r*(u-sin(u)) = a; eq2 := r*(cos(u)-1) = b;
sol := fsolve({eq1, eq2}, {r, u});
r0,u0:=op(subs(sol,[r,u]));
x := u->r0*(u-sin(u));
y := u->r0*(cos(u)-1);
plot([x(u),y(u),u=0..u0]);
Int(sqrt(diff(x(u),u)^2+diff(y(u),u)^2)/sqrt(-2*g*y(u)),u=0..u0);
evalf(%);

@Divhhh The time is given by the line integral


where s is arclength and v is velocity. From conservation of energy we have
1/2*m*v^2+m*g*y = C = 0 (if v = 0 at y = 0).
Thus v = sqrt(-2*g*y).
If the curve is given parametrically by x = x(u), y = y(u) (avoiding the use of t in order not to get confused), then ds/du = sqrt(x'(u)^2+y'(u)^2). Thus time spent on the curve (with u = 0 .. u0) is given by:

T = int( sqrt(x'(u)^2+y'(u)^2)/sqrt(-2*g*y(u)), u = 0..u0).
In Maple:

restart;
a := 1; b := -1:
g := 9.81:
eq1 := r*(u-sin(u)) = a; eq2 := r*(cos(u)-1) = b;
sol := fsolve({eq1, eq2}, {r, u});
r0,u0:=op(subs(sol,[r,u]));
x := u->r0*(u-sin(u));
y := u->r0*(cos(u)-1);
plot([x(u),y(u),u=0..u0]);
Int(sqrt(diff(x(u),u)^2+diff(y(u),u)^2)/sqrt(-2*g*y(u)),u=0..u0);
evalf(%);

A change of variable works for both:

G:=Int(x*exp(-x)*exp(-exp(-x)), x = -infinity .. infinity);
IntegrationTools:-Change(G,{x=-ln(u)});
value(%);
V:=Int((x-gamma)^2*exp(-x)*exp(-exp(-x)), x = -infinity .. infinity);
IntegrationTools:-Change(V,{x=-ln(u)});
value(%);


It might help to see my answer to your previous question "Get derivative":

http://www.mapleprimes.com/questions/146447-Get--Derivative

Correct, it doesn't. Not all integrals can be expressed in analytical form. This may be one of very many.

@geri23 You forgot part of the code.
After the assignment to res I had the lines (see above):
sol:=subs(res,[T1(t),T2(t)]);
plot(sol,t=0..10,10..20);
#Numerical solution:
resnum:=dsolve(sys,numeric);
plots:-odeplot(resnum,[[t,T1(t)],[t,T2(t)]],0..10);

@geri23 Did you execute my code exactly as written and did it not work? (Copy the entire code into a fresh worksheet).
And didn't you get graphs in both the analytical and the numeric case?

@geri23 Analytical and numerical solutions for a specific example:

restart;
eq1:=C1*diff(T1(t),t)=U12*(T2(t)-T1(t))+U13*(T3(t)-T1(t))+H1(t);
eq2:=C2*diff(T2(t),t)=U21*(T1(t)-T2(t))+U23*(T3(t)-T2(t))+H2(t);
ics:=T1(0)=Ta, T2(0)=Tb;
#The specific example:
params:={C1=25,C2=25,U12=40,U21=40,U13=20,U23=20,Ta=20,Tb=10,H1=(t->600), H2=(t->300),T3=(t->-5)};
#You can make H1, H2, T3 more interesting by making them not constant, e.g. making them periodic functions with period 24 hours. You need to think about what your unit of time is (second, minute, hour or what).
#The concrete system including initial conditions:
sys:=eval({eq1,eq2, ics},params);
#Analytical solution:
res:=dsolve(sys);
sol:=subs(res,[T1(t),T2(t)]);
plot(sol,t=0..10,10..20);
#Numerical solution:
resnum:=dsolve(sys,numeric);
plots:-odeplot(resnum,[[t,T1(t)],[t,T2(t)]],0..10);

@geri23 The syntax is wrong. Assuming that all the constants are known and the outside temperature T3(t) is known as a function of time (may vary according to time of day) the following will work:

eq1:=C1*diff(T1(t),t)=U12*(T2(t)-T1(t))+U13*(T3(t)-T1(t))+H1(t);
eq2:=C2*diff(T2(t),t)=U21*(T1(t)-T2(t))+U23*(T3(t)-T2(t))+H2(t);
ics:=T1(0)=Ta, T2(0)=Tb;
res:=dsolve({eq1,eq2, ics});

First 174 175 176 177 178 179 180 Last Page 176 of 231