Post Reply 
Arg(fourier_cn(...)) returns different answers
11-04-2019, 12:50 PM
Post: #1
Arg(fourier_cn(...)) returns different answers
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?
Find all posts by this user
Quote this message in a reply
11-05-2019, 04:08 PM
Post: #2
RE: Arg(fourier_cn(...)) returns different answers
fourier_cn now auto-assumes that n is an integer.
Find all posts by this user
Quote this message in a reply
11-06-2019, 03:48 AM (This post was last modified: 11-06-2019 03:50 AM by rombva.)
Post: #3
RE: Arg(fourier_cn(...)) returns different answers
(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.
Find all posts by this user
Quote this message in a reply
11-06-2019, 08:44 PM
Post: #4
RE: Arg(fourier_cn(...)) returns different answers
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.
Find all posts by this user
Quote this message in a reply
11-07-2019, 03:03 AM
Post: #5
RE: Arg(fourier_cn(...)) returns different answers
(11-06-2019 08:44 PM)parisse Wrote:  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.

Thanks!
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)