Carl Love

Carl Love

28100 Reputation

25 Badges

13 years, 103 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

@shakuntala In your originally posted code, you have the line blt:= 10. I assumed that this was still in effect. If it's not, then you must be solving a different ODE problem, in which case X21 and X11 wouldn't make sense either.

@acer If the OP is performing the NLPSolve inside a loop, as claimed, I'd more strongly recommend against using assign. It's still possible to use assign combined with some method of unassigning (either command unassign or assignments such as th:= 'th'), but that quickly turns into a mess. (Of course, I know that you know all the above; I just think that you may have missed the OP's "in a loop" issue.)

@shakuntala Yes, it's easy to combine any number of plots into one. One way is

plot([X11, X21], 0..blt);

The command plots:-display can be used in more-complicated cases:

plots:-display(
     plot(X11, 0..blt),
     plot(X21, 0..blt)

);

The inner plot commands can be any, as long as they all have the same dimension (two or three).

@Abdoulaye No, it doesn't help. There's a discontinuity in the link up of the two pieces at t = 11.72530194.

@jojokaila You can simplify the input of column vectors by using angle brackets:

A:= < 1/sqrt(2), 0, 0, 1/sqrt(2) >;

@jojokaila Oh, okay. I think that I understand your issue. Maple by default doesn't display vectors or matrices with more than 10 rows or columns. It only displays some information about them such as their dimensions. The computation has however still been done. If you want to see the results, then give the command

interface(rtablesize= 25);

before doing the computation. This command only needs to be given once per session, and it can be put in an initialization file. The 25 can be replaced by any positive integer or infinity. Personally, I have mine set at 25. Maple can easily handle computation of 1000 x 1000 matrices, but you wouldn't want one to accidentally display on your screen! That's why the rtablesize option exists.

@Abdoulaye No derivative. I just extracted the bounds of the second period from the original piecewise. The left boundary, op([9, 1, 1], F), is 11.72530194, and the right boundary, op([-2,-1,-1], F), is 17.46028352. I needed to add the 1e-7 because your intervals overlap at the their endpoints because you used <= everywhere instead of alternating <= with <.

@Abdoulaye Except for the horizontal pieces, the individual pieces contain polynomial terms and are certainly not periodic. It is only in the piecewise context that the function can be periodic.

Here's how you can approximate the error:

plot(abs(F - eval(F, t= t-2*Pi)), t= op([9,1,1], F)+1e-7..op([-2,-1,-1], F));

The plot shows that the maximum error is about 1.2e-7.

@Markiyan Hirnyk Here's a plot illustrating the corollary. Adjust n to any positive integer. The convergence of the maximum modulus to 2 is very rapid.

n:= 6:
R:= fsolve(z^n = add(z^k, k= 0..n-1), complex):
plots:-display([
     plot([Re,Im]~([R]), style= point, symbol= diagonalcross, symbolsize= 16),
     plot([1,2], t= 0..2*Pi, coords= polar, thickness= 0, color= blue)
     ], scaling= constrained, axes= boxed, view= [(-2.1..2.1)$2]
      , labels= [Re,Im]
);

I also modified the code in the Answer to show clearly what I meant by union~.

@Abdoulaye This plot command shows that the function is close enough to being 2*Pi periodic that there is no visible gap between the plots:

Fu:= eval(F, piecewise= piecewise[undefined]):
plot([Fu, eval(Fu, t= t-2*Pi)], t= op([1,1,1], F)..op([-2,-1,-1], F)+2*Pi);

On the other hand, clearly it is not exactly periodic because the horizontal piece 0.4977821578 isn't an exact match to the horizontal piece 0.4977820960.

But I wonder what is your true goal here. Are you actually trying to construct a periodic function by duplicating one fundamental period? If so, then that is easy to do, and I can show you how. Or are you truly trying to prove that a given function is periodic?

@shakuntala I already told you that you can plot using the command

plot([seq(X2||k, k= 1..1)], 0..blt);

Did you have trouble with that? Given that you actually only have one value of k in your original loop, you can simplify that to

plot(X21, 0..blt);

But it's X21, not X2. What gives you trouble in understanding that? Are you trying to follow some printed instructions that tell you to plot X2?

Please put Replies to an Answer below that Answer, not above.

@Abdoulaye Please either present the function in a plaintext form or attach a worksheet. I can't use it in the form that you present.

@shakuntala Well, like I said, X2 by itself is meaningless. There's

X21(0);

     .332057384255589

There's no need to use print.

@Markiyan Hirnyk I redefine A and S analogously for the three-consecutive problem. We have S[n] = S[n-1] union {members of S[n-1] that it's safe to add n to, unioned with {n}} union {members of S[n-1] that it's safe to add both n and n-1 to unioned with {n, n-1}}. So A[n] = A[n-1] + A[n-2] + A[n-3]. So, the asympototic growth factor is the maximum modulus of the roots of z^3 = z^2 + z + 1, which is 1.839....

Corollary: For any positive integer n, the maximum modulus of the roots of z^n = sum(z^k, k= 0..n-1) is strictly between 1 and 2.

@Markiyan Hirnyk I'm still thinking about the case of three consecutive numbers.

First 384 385 386 387 388 389 390 Last Page 386 of 709