Preben Alsholm

13743 Reputation

22 Badges

20 years, 336 days

MaplePrimes Activity


These are replies submitted by Preben Alsholm

I haven't looked at this version, but have just answered your additional question in your previous posting. Please take a look at that.

@felixiao I made some changes. There were still some instances of F(tau), P(tau), Q(tau)  which needed to be replaced with F, P, Q, respectively. I replaced 'matrix' with 'Matrix' and `&*` with `.`. Also 'Inverse' was replaced with `^(-1)`.

MaplePrimes13-03-08.mw

@felixiao I made some changes. There were still some instances of F(tau), P(tau), Q(tau)  which needed to be replaced with F, P, Q, respectively. I replaced 'matrix' with 'Matrix' and `&*` with `.`. Also 'Inverse' was replaced with `^(-1)`.

MaplePrimes13-03-08.mw

I was briefly looking at this and decided to remove all the underscores. That should be harmless of course.
Then tested my answer to your previous question, but now I got 94 solutions instead of 90. Weird!
I used Edit/ Find/Replace in Maple.  For the record, here is the code with the underscores removed:
restart;
S := Matrix( [ [a1, a2, a3, a4], [b1, b2, b3, b4], [c1, c2, c3, c4], [d1, d2, d3, d4] ] );
eq1:=a1*d1 = b1*c1, a2*d2 = b2*c2, a3*d3 = b3*c3, a4*d4 = b4*c4;
R := Matrix( [ [s1, t1, r1, l1], [s2, t2, r2, l2], [s3, t3, r3, l3], [s4, t4, r4, l4] ] );
eq2:=s1*l1 = t1*r1,s2*l2 = t2*r2,s3*l3 = t3*r3,s4*l4 = t4*r4;
T := Matrix( [ [1, 0, 0, 1], [0, 1, 0, 0], [0, 1, 0, 0], [1, 0, 0, 1] ] );
S.R=~T;
convert(%,set);
res:=solve(% union {eq1,eq2});
nops([res]);
res[1];


Could you give us the expression you want to minimize? In text here or as an uploaded worksheet.

restart;
sys := [diff(y(x), x) = -(4*cos(x)*y(x)+z(x)*cos(x)^2+3*z(x))/(sin(x)*(cos(x)^2-9)),
diff(z(x), x) = -(y(x)*cos(x)^2+3*y(x)+4*z(x)*cos(x))/(sin(x)*(cos(x)^2-9))];

normal(sys[1]+sys[2]);
#Letting u = y+z:
eqS:=eval(%,{z=0,y=u});
U:=dsolve(eqS) assuming real;
normal(sys[1]-sys[2]);
#Letting v = y-z:
eqD:=eval(%,{z=0,y=v});
dsolve(eqD) assuming real;
V:=subs(_C1=_C2,%);
y(x)=rhs((U+V)/2);
z(x)=rhs((U-V)/2);





@Markiyan Hirnyk I noticed that the right hand sides of sys shared singularities defined by sin(x) = 0.
Thus the variable change from x to t given by diff(x(t),t)=sin(x(t)) seemed natural because the ode system in X(t), Y(t) would be without singularities (by the chain rule dy/dt = (dy/dx)*(dx/dt)=(dy/dx)*sin(x) ).
Omitting the last line in my comment above and setting
res:= collect(%,[_C1,_C2],normal);
#the solutions can be extended to all of R by

res2:=eval(res,{(1+cos(x))^(-1/2)=1/(sqrt(2)*cos(x/2)),sqrt(1+cos(x))=sqrt(2)*cos(x/2)});
odetest(res2,sys); #Checking
y1,z1:=op(eval(subs(res2,[y(x),z(x)]),{_C1=1,_C2=0}));
y2,z2:=op(eval(subs(res2,[y(x),z(x)]),{_C1=0,_C2=1}));
plot([y1,y2,z1,z2],x=0..4*Pi);

Since you left sol1[2] to the MaplePrimes users I thought I might try a variant of the idea.

restart;
sys := [diff(y(x), x) = -(4*cos(x)*y(x)+z(x)*cos(x)^2+3*z(x))/(sin(x)*(cos(x)^2-9)),
diff(z(x), x) = -(y(x)*cos(x)^2+3*y(x)+4*z(x)*cos(x))/(sin(x)*(cos(x)^2-9))];
#Making the change of variable given by sin(x)*diff(y,x) = diff(y,t),
# i.e. diff(x(t),t)=sin(x(t)) and choosing x(0) = Pi/2:  
int(1/sin(x1),x1=Pi/2..x, AllSolutions) assuming x>0,x<Pi;
St:=t=combine(%) assuming x>0,x<Pi;
dsolve({diff(x(t),t)=sin(x(t)),x(0)=Pi/2});
Sx:=subs(x(t)=x,%);
PDEtools:-dchange({Sx,y(x)=Y(t),z(x)=Z(t)},sys,[t,Y,Z]):
sys2:=combine(solve(%,{diff(Y(t),t),diff(Z(t),t)}));
tres:=dsolve(sys2) assuming t>0;
PDEtools:-dchange({St,Y(t)=y(x),Z(t)=z(x)},tres,[x,y,z]):
simplify(%) assuming real;
collect(%,[_C1,_C2],normal);
subs(sin(x)=sqrt(1-cos(x))*sqrt(1+cos(x)),%);

@matja There must have been something else interfering with the assume command since the following works:

restart;
assume(a>0);
limit(exp(-a*x), x = infinity);

@matja There must have been something else interfering with the assume command since the following works:

restart;
assume(a>0);
limit(exp(-a*x), x = infinity);

Certainly S1+S2 is the sum of the two expressions, so I don't know what your problem is. Do you want to use simplify, expand, or combine on the sum or what?

An animation:

plots:-animate(plot, [S, theta = 0 .. 10], t = 0 .. 1, frames = 100);

The sum in S1 is the first few terms of

Sum(cos((2*k+1)*theta)/(2*k+1)*(-1)^k,k=0..infinity);

which is the Fourier series of

f:=piecewise(abs(theta)<Pi/2,Pi/4,-Pi/4);


restart;
eq1:=eval(x*tan(x)-I*i*Pi/(1+I*i*Pi), i = 10);
eq2:=eval((1+I*i*Pi)*x*sin(x)-I*i*Pi*cos(x), i = 10);
res:=RootFinding:-Analytic(eq2, x = -20-I .. 20+I);
nops([res]);
#Check:
evalf(eval~(eq1,x=~[res]));
simplify(fnormal(%,8));

restart;
eq1:=eval(x*tan(x)-I*i*Pi/(1+I*i*Pi), i = 10);
eq2:=eval((1+I*i*Pi)*x*sin(x)-I*i*Pi*cos(x), i = 10);
res:=RootFinding:-Analytic(eq2, x = -20-I .. 20+I);
nops([res]);
#Check:
evalf(eval~(eq1,x=~[res]));
simplify(fnormal(%,8));

@Markiyan Hirnyk By doing successively

RootFinding:-Analytic(eval(x*tan(x)-I*i*Pi/(1+I*i*Pi), i = 10), x = -20-I .. 20+I);
RootFinding:-Analytic(eval(x*tan(x)-I*i*Pi/(1+I*i*Pi), i = 10), x = -20-I .. 20+I,continue);

you find 6 roots.

@Markiyan Hirnyk By doing successively

RootFinding:-Analytic(eval(x*tan(x)-I*i*Pi/(1+I*i*Pi), i = 10), x = -20-I .. 20+I);
RootFinding:-Analytic(eval(x*tan(x)-I*i*Pi/(1+I*i*Pi), i = 10), x = -20-I .. 20+I,continue);

you find 6 roots.

First 178 179 180 181 182 183 184 Last Page 180 of 231