Preben Alsholm

MaplePrimes Activity


These are replies submitted by Preben Alsholm

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});

We need to see the set of ODEs.

@geri23 From your description it seems to me that the system would be something like:

C1*diff(T1(t),t)=U12*(T2(t) -T1(t))+ U01*(Tout -T1(t))+ H1(t);
C2*diff(T2(t),t)=U12*(T1(t) -T2(t))+ U02*(Tout -T2(t))+H2(t);


where Tout is the outside temperature and the constants Uij > 0, Ci > 0. You didn't say what H1(t) or H2(t) were, but they must be heating sources inside the two rooms. In order to solve the system, you need information about those:  Are they in fact known constants?
To solve the system you need the initial values of T1 and T2.
dsolve should be able to solve this linear system with no problem (certainly no problem if H1 and H2 are constants).

@Kivo69 The integral in this problem won't go away by differentiation.
Maybe replacing the integrand with a series expansion about xi would at least initially be interesting:

IntegrationTools:-GetIntegrand(eq3);
series(%,zeta=xi,2);
convert(%,polynom);
Int(%,zeta=0..1);
value(%);
eq3a:=evalindets(eq3,specfunc(anything,Int),x->u);
#I haven't had time to look further


Are i and j indices or just names?
If they are indices, say i = 1 .. n , j = 1 .. n, then you could clarify the question by writing out all the equations when n = 2. Can i be equal to j?
If i and j are just names and you only have one equation then you need to know what Tj(t) is (and Hi,Uij,Ci of course).

@KatePirs In one of your by now numerous postings of this question it has been pointed out (I think by Carl Love) that your x-range might as well be considerably smaller. Anyway, try this:

IBC2 := {ui(-10, t) = 0, ui(10, t) = 0, ui(x, 0) = 0, ur(-10, t) = 0, ur(10, t) = 0, ur(x, 0) = 1/cosh(x)};
sol := pdsolve({l1, l2}, IBC2, funcs, numeric, time = t);
sol:-plot([ui,ur],t=10);
sol:-animate([ui,ur],t=500,frames=100);
sol:-plot(ur,t=0,x=-10..10,numpoints=500);
plot(1/cosh(x),x=-10..10);


The similarity is striking.

@KatePirs In one of your by now numerous postings of this question it has been pointed out (I think by Carl Love) that your x-range might as well be considerably smaller. Anyway, try this:

IBC2 := {ui(-10, t) = 0, ui(10, t) = 0, ui(x, 0) = 0, ur(-10, t) = 0, ur(10, t) = 0, ur(x, 0) = 1/cosh(x)};
sol := pdsolve({l1, l2}, IBC2, funcs, numeric, time = t);
sol:-plot([ui,ur],t=10);
sol:-animate([ui,ur],t=500,frames=100);
sol:-plot(ur,t=0,x=-10..10,numpoints=500);
plot(1/cosh(x),x=-10..10);


The similarity is striking.

@helix  Something like this:

with(plots):
p1:=animate(arrow,[<cos(tend),sin(tend),0.9*tend>,<-cos(tend),-sin(tend),0>,color=red],tend=0..50,axes=boxed,frames=150);
alpha:=1:
p2:=animate(textplot3d,[[[-1.8,0,alpha*tend,piecewise(tend<=12,"",tend<=25,"position","")]]],tend=0..50,axes=boxed,frames=150);
display(p1,p2);

@helix  Something like this:

with(plots):
p1:=animate(arrow,[<cos(tend),sin(tend),0.9*tend>,<-cos(tend),-sin(tend),0>,color=red],tend=0..50,axes=boxed,frames=150);
alpha:=1:
p2:=animate(textplot3d,[[[-1.8,0,alpha*tend,piecewise(tend<=12,"",tend<=25,"position","")]]],tend=0..50,axes=boxed,frames=150);
display(p1,p2);

There are various ways. But we shall need the details, i.e. all the lines of code.

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