Preben Alsholm

13471 Reputation

22 Badges

20 years, 299 days

MaplePrimes Activity


These are replies submitted by Preben Alsholm

rsolve doesn't use f(0)=1:
restart;
eq:=f(n)=f(n-1)/2+f(n+1)/2;
pb:={eq, f(0)=1, f(6)=0};
res:=rsolve(pb, {f(n)});
eval(%,n=0); #Using that f(0)=1 we get:
res2:=eval(res,f(5)=1/6);


It is not explicitly stated in the help page for rsolve, but seems to be assumed that boundary conditions are given sequentially with none missing between lowest and highest n. Since only two conditions can be given here, f(0) and f(1) could be given, or f(5) and f(6) for instance.

Example:
pb2:={eq, f(5)=1/6, f(6)=0};
rsolve(pb2,f(n));


@vv Actually, the result is not wrong, but isn't satisfactory since f(0) = 1 is not used:

eq:=f(n)=f(n-1)/2+f(n+1)/2;
pb:={eq, f(0)=1, f(6)=0};
res:=rsolve(pb, {f(n)});
eval(%,n=0); #So using that f(0)=1 we get:
res2:=eval(res,f(5)=1/6);


@vv and Markiyan: Thanks for the references.

Thank you Carl (and acer) for sharing with us this insight.

Off topic, but inspired by the fact that the false eigenvalues RPf (as remarked by Carl) seems to lie on a circle, I recalled my observation a few years ago that a randomly chosen polynomial of high degree has roots which tend to cluster around a circle of radius 1.
I wondered why, and still do.

restart;
p:=RandomTools:-Generate(polynom(integer(range=-99..99),z,degree=100));
r:=fsolve(p=0,z,complex):
plots:-complexplot([r],style=point,symbol=circle,scaling=constrained);

To get all 50 roots:

degree(g,x); #50
fsolve(g=0,x,complex); #Include the imaginary ones
nops([%]); #50

@canoiras Although it is certainly not clear to me precisely what you want to do, I should point out that in the example, which I gave in my answer below, I used boolean variables essentially to switch from one form of the system to another. These boolean variables are changed by the events specified.
Maybe you could give the Maple code, you already have, for us to work on.

@Bendesarts You cannot have equations in plot. Use a parametric plot:

plot([seq([Pz[i],t,t=-0.1..0.1],i=1..nops(Pz))],colour=yellow,linestyle=3, thickness=2,view=[0..2,default]);

Adjust [Pz[i],t,t=-0.1..0.1] to taste.

@Bendesarts If you do this:

restart;
for i to 4 do
  u[i]:=unapply(L/2*cos(w*t+phi[i]),t);
  Equ[i]:=evaln(u[i](t))=u[i](t)
end do;
## then you have
Equ[1];
              (1/2)*L*cos(t*w+phi[1]) = (1/2)*L*cos(t*w+phi[1])

Certainly true, but not exciting!

So if you just want to define the u[i]'s as functions, then you shouldn't define equations, you should just assign to u[i] as in e.g:
restart;
for i to 4 do u[i]:=unapply(L/2*cos(w*t+phi[i]),t) end do;
#Test:
u[1](s);




@Thomas Richard This way it exhibits well as it is run, but try afterwards:
Eq[1];

This is just stating that a=a, so to speak.

I tried from within Maple using "Check for Updates". It took forever (50 minutes at least), and stalled when 8 seconds were left, or so it claimed. Then at some point it "decided" to try again and announced a long download time (about 50 minutes again). I went shopping for beer. When I came back my computer had fallen asleep, but when I woke it up the downloading was not finished, but later it stalled at 5 seconds left. Then apparently it gave up. 

I then tried the Maplesoft website. The update downloaded very rapidly and installed without problem.

There appear two versions of _Z1 and two versions of _Z2, and that is weird. Certainly a bug.

restart;
eq:=Diff(W(t), t) = -q*V*(sin(Phi)-sin(Psi[s]))/(2*h*Pi)
soln := solve([rhs(eq) = 0, Phi < 2*Pi], [Phi], allsolutions = true,explicit);
idts:=indets(soln,`local`);
nops(idts); #4
addressof~(idts);
nops(%); #4
getassumptions(idts[1]);#
getassumptions(idts[2]);#These are not the same assumptions
Lidts:=convert(idts,list);
S:=Lidts=~[z11,z12,2,3];
subs(S,soln);

Note: Another strange thing: If you replace Psi[s] with an unindexed name like psi, then you will notice that idts has five members: assumptions are made on psi. If you try replacing Psi[s] with Psi (which is an initially known function in Maple) you get an error message from solve saying
Error, (in assume) cannot assume on an assigned name



Please see a related discussion:
http://mapleprimes.com/questions/208328-Differential-Equation-And--Notation-Question

Get rid of the units (after having made them conform to each other) or introduce dimensionless variables. Then compute.

@tomleslie I'm not a big fan of units either. 
The expression exp(-4000*t) can be nothing but a pure number with no unit no matter what t is or what unit is used.
Just think of the series expansion for exp.
exp(x) = convert(exp(x),FormalPowerSeries,x);

If the unit of x is U what is the unit of exp(x)?

My thinking is: get your units straight from the start, perhaps with the help of Maple, then forget about them, and compute!

@tomleslie What would be the unit for t?

@shahid Sorry, I don't.

First 86 87 88 89 90 91 92 Last Page 88 of 225