Kitonum

21435 Reputation

26 Badges

17 years, 23 days

MaplePrimes Activity


These are replies submitted by Kitonum

@Markiyan Hirnyk  In the attached file there is an ordinary Fourier series.

@Markiyan Hirnyk  See the timing in M 12:

restart;
a := rsolve({X(0) = 0, X(1) = 1, X(2) = 2, X(n) = n*(X(n-3)+X(n-2)+X(n-1))}, X, makeproc):

t:=time(): ceil(log[10](a(10000))); time()-t;

                                                                 35664

                                                                 11.578

 

restart;
NumberOfDigits:=proc(N)
local X, n;
X[0]:=0; X[1]:=1; X[2]:=2;
   for n from 3 to N do
   X[n]:=n*(X[n-3]+X[n-2]+X[n-1]);
   od;
length(%);
end proc:

t:=time(): NumberOfDigits(10000); time()-t;

                                                           35664

                                                           0.297

 

restart;
X:= proc(n)
option remember;
n*(X(n-3)+X(n-2)+X(n-1))
end proc:

t:=time():  X(0),X(1),X(2):= 0,1,2:
length(X(10000));  time()-t;

                                                            35664

                                                            0.312

 

I think the reason is that  length  command a lot more effective than ceil@log[10] .

@Carl Love  Unfortunately, in M 12 your code works incorrectly. Easy adjustment solves the problem:

X:= proc(n)

option remember;

     n*(X(n-3)+X(n-2)+X(n-1))

end proc:

X(0),X(1),X(2):= 0,1,2:

 

length(X(2013));

              5782

@Suji  '$'(1,6)  means the sequence  1,1,1,1,1,1 . Another variant is  1 $ 6 .

@Markiyan Hirnyk  Thanks for the hint!

Corrected code:

Fourier := proc (f, n::{infinity, nonnegint})

local a0, a, b;

a0 := (1/2)*(int(f(x), x = -Pi .. Pi))/Pi;

a := proc (k) options operator, arrow; `assuming`([int(f(x)*cos(k*x), x = -Pi .. Pi, AllSolutions)], [k::posint])/Pi end proc;

b := proc (k) options operator, arrow; `assuming`([int(f(x)*sin(k*x), x = -Pi .. Pi, AllSolutions)], [k::posint])/Pi end proc; 

if n = infinity then return a0+Sum(simplify(a(k)*cos(k*x)+b(k)*sin(k*x), assume = k::posint), k = 1 .. n) else

a0+add(a(k)*cos(k*x)+b(k)*sin(k*x), k = 1 .. n) end if;

end proc;

 

Now there is no the error.

@Markiyan Hirnyk  This is the bug in Maple. See

int(sin(x)*sin(k*x), x = -Pi .. Pi) assuming k::posint;

                                         0

The result is wrong for k = 1

@Carl Love  In  M 12 only  sort  without options does not work:

sort([[2,1],[3,2],[5,3],[1,4],[4,5]]);

                  [[2, 1], [3, 2], [5, 3], [1, 4], [4, 5]]

@ANANDMUNAGALA   Jacobi's method requires only the simplest of the rotation matriсes, such as those

See the solution http://www.mapleprimes.com/questions/200181-What-Is-The--Maple-Procedure-To-Find

@brian bovril  We must prove that outside a bounded interval there are no roots. It is not enough to refer to the plot of the function.

@Carl Love  Thanks a lot for the solution of the problem!

@Carl Love In Maple 12 (Classic) and Maple 16 (Standard) the result is correct. May be this is a bug in Maple 17?

1) The  simplex[convexhull]  command can be adapted to the verification of the polygon on the convexity. But it still solves another problem and works only with data type numeric. It is not always convenient. See the screenshot.

2) The  IsSimple  procedure solves your example correctly. See the screenshot.

 

 

@Carl Love  Of course, you're right! The range  [-11, -9]  is not included in the domain of the function. We have

 Range( limit(sqrt((x^2-5*x+6)/log[10]((x+10)^2)), x = 2),  limit(sqrt((x^2-5*x+6)/log[10]((x+10)^2)), x = -9, right)); 

                                                                 Range(0,  infinity)

I like Axel's code more than mine, because it automatically divides the sum by two parts depending on  x  and is suitable for various  x. I only suggest to simplify it:

g:= x ->
    Sum(sin(x/(k+1))/k, k = 1 .. floor(x)) + Sum(sin(x/(k+1))/k, k = 1+floor(x) .. infinity);
   
plot(g, 0 .. 100);

 

First 113 114 115 116 117 118 119 Last Page 115 of 132