11-04-2019, 12:50 PM
Post: #1
 rombva Junior Member Posts: 38 Joined: Oct 2019
Suppose f(x):=when(x>-Pi and x<0,-1,when(x>=0 and x<Pi,1,0)).

Then Arg(fourier_cn(f(x),x,2*Pi,n,-Pi)) returns different answers accordingly to the assumption for n. With integer assumpton for n Arg(fourier_cn(...)) returns a correct answer, but without any assumption for n it returns the result which is like odd and even indexes swaped while substituting various integer values n.

Is it proper?
11-05-2019, 04:08 PM
Post: #2
 parisse Senior Member Posts: 1,136 Joined: Dec 2013
fourier_cn now auto-assumes that n is an integer.
11-06-2019, 03:48 AM (This post was last modified: 11-06-2019 03:50 AM by rombva.)
Post: #3
 rombva Junior Member Posts: 38 Joined: Oct 2019
(11-05-2019 04:08 PM)parisse Wrote:  fourier_cn now auto-assumes that n is an integer.

That's right. In this case I get 1/2*Pi*sign((-1)^n-1) and subst(arg(1/2*Pi*sign((-1)^n-1)),n=1) returns -1/2*Pi.

But these steps cause the wrong answer:

1. assume(n,integer) returns [DOM_INT]

2. fourier_cn(f(x),x,2*Pi,n,-Pi) returns ((-1)^n*i-i)/(n*Pi)

3. purge(n) returns [DOM_INT]

4. simplify(arg(((-1)^n*i-i)/(n*Pi))) returns 1/2*(n*Pi-2*Pi*floor((n+1)/2)-Pi*sign(n)-Pi*sign(tan(n*Pi/2)))

5. subst(1/2*(n*Pi-2*Pi*floor((n+1)/2)-Pi*sign(n)-Pi*sign(tan(n*Pi/2))),n=1) returns undef and subst(1/2*(n*Pi-2*Pi*floor((n+1)/2)-Pi*sign(n)-Pi*sign(tan(n*Pi/2))),n=2) returns -1/2*Pi and so on.
11-06-2019, 08:44 PM
Post: #4
 parisse Senior Member Posts: 1,136 Joined: Dec 2013
That's because floor is discontinuous, and as explained above CAS assumes that parameter have generic values. It is therefore important to make assumptions like assume(m,integer); n:=2*m; before calling simplification.
11-07-2019, 03:03 AM
Post: #5
 rombva Junior Member Posts: 38 Joined: Oct 2019