Preben Alsholm

13728 Reputation

22 Badges

20 years, 249 days

MaplePrimes Activity


These are replies submitted by Preben Alsholm

Notice that there is no difference between the name T and the name `T`.
However, something like `T ` (i.e. a space after T) would be different from T. That is why in my comment above I called the same quantity Tseq.

@J4James Changing slightly the answer by Kitonum you could do the following.

restart;
n:=3:
ode1:=diff(T(x),x$2)-T(x)^2=0;
ode2:=diff(S(x),x)=T(x); #To find the T average
bc:=T(0)=1,T(n)=0,S(0)=0;
V:=dsolve({ode1,ode2, bc}, numeric,output=listprocedure);
VT,VS:=op(subs(V,[T(x),S(x)]));
AverageT:=VS(n)/n;
dx:=1/1000;
Tseq:=seq(VT(i),i=0..n,dx):
N:=nops([Tseq]);
theta1:=sqrt(add((Tseq[i]-AverageT)^2, i=1..N)/(N-1))/AverageT;
#N is roughly
n/dx;
#so you could integrate instead of sum:
theta2:=sqrt( evalf(Int((VT(x)-AverageT)^2,x=0..n))/n)/AverageT;

@J4James Changing slightly the answer by Kitonum you could do the following.

restart;
n:=3:
ode1:=diff(T(x),x$2)-T(x)^2=0;
ode2:=diff(S(x),x)=T(x); #To find the T average
bc:=T(0)=1,T(n)=0,S(0)=0;
V:=dsolve({ode1,ode2, bc}, numeric,output=listprocedure);
VT,VS:=op(subs(V,[T(x),S(x)]));
AverageT:=VS(n)/n;
dx:=1/1000;
Tseq:=seq(VT(i),i=0..n,dx):
N:=nops([Tseq]);
theta1:=sqrt(add((Tseq[i]-AverageT)^2, i=1..N)/(N-1))/AverageT;
#N is roughly
n/dx;
#so you could integrate instead of sum:
theta2:=sqrt( evalf(Int((VT(x)-AverageT)^2,x=0..n))/n)/AverageT;

Playing a little with the two branches of the square root:

restart;
eq:=sqrt(x+3-4*sqrt(x-1))+sqrt(x+8-6*sqrt(x-1)) = 1;
plot([op(eq)],x=1..15,0..2,thickness=2); #Perfectly fine
R:=convert(lhs(eq),RootOf);
plot([R,1],x=1..15,0..2,thickness=2); #Still perfectly fine
subs((index=1)=NULL,R); #Now forgetting about the branch (index)
L:=[allvalues(%)];
plots:-display(seq(plot(L[k],x=-5..15),k=1..nops(L)),insequence=true);

#One of these (number 7 for me) is constantly 1.

Playing a little with the two branches of the square root:

restart;
eq:=sqrt(x+3-4*sqrt(x-1))+sqrt(x+8-6*sqrt(x-1)) = 1;
plot([op(eq)],x=1..15,0..2,thickness=2); #Perfectly fine
R:=convert(lhs(eq),RootOf);
plot([R,1],x=1..15,0..2,thickness=2); #Still perfectly fine
subs((index=1)=NULL,R); #Now forgetting about the branch (index)
L:=[allvalues(%)];
plots:-display(seq(plot(L[k],x=-5..15),k=1..nops(L)),insequence=true);

#One of these (number 7 for me) is constantly 1.

I think you need more than 5 terms due to the sine term in the series definition. 10 terms seems more like it.

JT1:= 2*q^(1/4)*Sum((-1)^n*q^(n*(n+1))*sin((2*n+1)*z),n=0..infinity);
evalc(abs(sin((2*n+1)*Pi*I*(a+b*I))));
simplify(%);
T:=(1/10)^(n*(n+1))*exp((2*n+1)*Pi*a);
seq(evalf[20](eval(T,a=4)),n=1..11);
diff(T,n);
solve(%=0,n);
evalf(eval(%,a=4));

I think you need more than 5 terms due to the sine term in the series definition. 10 terms seems more like it.

JT1:= 2*q^(1/4)*Sum((-1)^n*q^(n*(n+1))*sin((2*n+1)*z),n=0..infinity);
evalc(abs(sin((2*n+1)*Pi*I*(a+b*I))));
simplify(%);
T:=(1/10)^(n*(n+1))*exp((2*n+1)*Pi*a);
seq(evalf[20](eval(T,a=4)),n=1..11);
diff(T,n);
solve(%=0,n);
evalf(eval(%,a=4));

@ilods Thank you very much and Happy New Year!

@ilods Thank you very much and Happy New Year!

What is known about the parameters, i, u, n, p, y?

@lesshaste Yes, if you make che change of variable B(p) = c(n-1-p) then c(0)=1+(n-1)/n*A(0):

For comparison I start as before:

restart;
RA:=A(k)=1+((n-k-2)/n)*A(k+1)+(2/n)*B(k+1)+(k/n)*(A(0));
RB:= B(k)=1+((n-k-1)/n)*B(k+1)+(k/n)*A(0);
#RA holds for k = 0 .. n-2 and RB holds for k = 1 .. n-1: 
T:=NULL:
for n from 2 to 6 do
  SA:=seq(RA,k=0..n-2);
  SB:=seq(RB,k=1..n-1);
  T:=T,solve({SA,SB},{seq(A(k),k=0..n-2),seq(B(k),k=1..n-1)})
end do:
T;
n:='n':
eval(RB,k=n-1-p);
eq:=eval(%,B=(p->c(n-1-p)));
resc:=rsolve({eq,c(0)=1+(n-1)/n*A(0)},c(p));
eval(resc,p=n-k-1);
resB:=B(k)=eval(%,c=(k->B(n-1-k)));
#Tests:
simplify(eval(resB,{k=1,n=3}));
eval(%,T[2]);
seq(eval(simplify(eval(resB,{k=1})),T[n-1]),n=2..6);
seq(simplify(eval(resB,{n=3} union T[2])),k=1..2);
seq(seq(simplify(eval(resB,T[n-1])),k=1..n-1),n=2..6);
##Now we can use the result for B in RA.
##Presumably a similar change of variable could work for A, but I have not attempted it.
##Only a couple of tests:
res:=eval(RA,eval(resB,k=k+1));
eval(res,n=3);
seq(%,k=0..1);
simplify([%]);
solve(%,{A(0),A(1)});
T[2];
eval(res,n=4);
seq(%,k=0..2);
simplify([%]);
solve(%,{A(0),A(1),A(2)});
T[3];

@lesshaste Yes, if you make che change of variable B(p) = c(n-1-p) then c(0)=1+(n-1)/n*A(0):

For comparison I start as before:

restart;
RA:=A(k)=1+((n-k-2)/n)*A(k+1)+(2/n)*B(k+1)+(k/n)*(A(0));
RB:= B(k)=1+((n-k-1)/n)*B(k+1)+(k/n)*A(0);
#RA holds for k = 0 .. n-2 and RB holds for k = 1 .. n-1: 
T:=NULL:
for n from 2 to 6 do
  SA:=seq(RA,k=0..n-2);
  SB:=seq(RB,k=1..n-1);
  T:=T,solve({SA,SB},{seq(A(k),k=0..n-2),seq(B(k),k=1..n-1)})
end do:
T;
n:='n':
eval(RB,k=n-1-p);
eq:=eval(%,B=(p->c(n-1-p)));
resc:=rsolve({eq,c(0)=1+(n-1)/n*A(0)},c(p));
eval(resc,p=n-k-1);
resB:=B(k)=eval(%,c=(k->B(n-1-k)));
#Tests:
simplify(eval(resB,{k=1,n=3}));
eval(%,T[2]);
seq(eval(simplify(eval(resB,{k=1})),T[n-1]),n=2..6);
seq(simplify(eval(resB,{n=3} union T[2])),k=1..2);
seq(seq(simplify(eval(resB,T[n-1])),k=1..n-1),n=2..6);
##Now we can use the result for B in RA.
##Presumably a similar change of variable could work for A, but I have not attempted it.
##Only a couple of tests:
res:=eval(RA,eval(resB,k=k+1));
eval(res,n=3);
seq(%,k=0..1);
simplify([%]);
solve(%,{A(0),A(1)});
T[2];
eval(res,n=4);
seq(%,k=0..2);
simplify([%]);
solve(%,{A(0),A(1),A(2)});
T[3];

@lesshaste I would do it the same way (eval or subs, no real difference in this case).

To get a sequence of A(0) for n = 2 to (e.g. 10) one could do:

S:=NULL:
for n from 2 to 10 do
  SA:=seq(RA,k=0..n-2);
  SB:=seq(RB,k=1..n-1);
  S:=S,subs(solve({SA,SB},{seq(A(k),k=0..n-2),seq(B(k),k=1..n-1)}),A(0))
end do:
S;
evalf(S);

@lesshaste I would do it the same way (eval or subs, no real difference in this case).

To get a sequence of A(0) for n = 2 to (e.g. 10) one could do:

S:=NULL:
for n from 2 to 10 do
  SA:=seq(RA,k=0..n-2);
  SB:=seq(RB,k=1..n-1);
  S:=S,subs(solve({SA,SB},{seq(A(k),k=0..n-2),seq(B(k),k=1..n-1)}),A(0))
end do:
S;
evalf(S);

@Douglas Lewit Done, hopefully. But I think you should have suppressed the output from balance2 and Balance2.

First 185 186 187 188 189 190 191 Last Page 187 of 230