Is there a way to check whether or not this is a floating point error?

asked 2017-08-05 23:03:25 +0200

Andres Mejia gravatar image

I have the following functions defined:

var('k,j,N')

s(k)=sin(4*pi*k/N)*sin(2*pi/N*(k+1))*sin(2*pi/N*(k-1))
w(k)=(sin(2*pi/N*(k-1))/sin(2*pi/N*k)*sin(4*pi/N))*sin(2*pi/N)
AA(N,j,k)=s(k)+s(j)+sin(2*pi*6/N)*sin(2*pi*2/N)/(sin(2*pi*3/N)*sin(2*pi/N))*(w(k)+w(j))-sin(4*pi*2/N)*sin(2*2*pi/N)/sin(2*pi/N)*(w(k)*w(j))-sin(2*pi*6/N)*sin(2*pi*2/N)/(sin(2*pi*3/N)*sin(2*pi/N))

assume(j>1,k>1,N>8*(j+k+1),N>10)

Now, if I use the solve function:

sage: solve(AA(N,j,k)==0,N)

I get the output

[sin(4*pi*k/N) == (sin(8*pi/N)*sin(6*pi/N)*sin(4*pi/N)^3*sin(2*pi/N)^2*sin(-2*(pi
- pi*j)/N)*sin(-2*(pi - pi*k)/N) - sin(2*pi*j/N)*sin(12*pi/N)*sin(4*pi/N)^2*sin(2*pi/N)*sin(-2*(pi
- pi*k)/N) - (sin(4*pi*j/N)*sin(2*pi*j/N)*sin(6*pi/N)*sin(2*pi/N)*sin(2*(pi
+ pi*j)/N)*sin(-2*(pi - pi*j)/N) + sin(12*pi/N)*sin(4*pi/N)^2*sin(2*pi/N)*sin(-2*(pi
- pi*j)/N) - sin(2*pi*j/N)*sin(12*pi/N)*sin(4*pi/N))*sin(2*pi*k/N))/(sin(2*pi*j/N)*sin(2*pi*k/N)*sin(6*pi/N)*sin(2*pi/N)*sin(2*(pi
+ pi*k)/N)*sin(-2*(pi - pi*k)/N))]

However, it is my hope that this equation has no solutions. Indeed, if I add to the assumption that AA(N,j,k)>0, I obtain a contradiction (inconsistent assumptions), but if I add AA(N,j,k)==0, I don't get inconsistent assumptions.

Is there a way to check if this is a floating point error, or if there really is a solution with my assumptions?

edit retag flag offensive close merge delete

Comments

1

Please write mathematically what you need, it may be simpler to compile the code. So for instance, we can set $$x=\frac{2\pi}N$$ and write simpler formulas, e.g. $$s(k) = \sin(2kx)\sin((k-1)x)\sin((k+1)x)\ ,$$ $$w(k)= \frac{\sin((k-1)x)}{\sin(kx)}\sin(2x)\sin x\ .$$ (And i do not get the point of the one more bracket in the definition of w(k).) Now AA is hard to compile humanly. (Can it be written mathematically in a simple manner?)

Please explain now the question.

  • Of course, the two assumptions are incompatible, inconsistent.
  • Are the variables jand k numers in practice? Or symbolic variables and we want to solve using sage a theoretical question. (But then where is the floating value?)
  • The answer above is an echo. Where can a floating point error occur?
dan_fulea gravatar imagedan_fulea ( 2017-08-08 01:37:35 +0200 )edit