vv

14122 Reputation

20 Badges

10 years, 238 days

MaplePrimes Activity


These are replies submitted by vv

@Carl Love 

The method would work for systems of the form

sum( a[i,j]*floor(f[i,j]), j=1..n ) = b[i],  i = 1,...,n

where f[i,j] is affine in x[1],...,x[n]  and a[i,j], b[i] are integers.
But such systems may have infinitely many regions. In this case we could use the parametric form of SemiAlgebraic but complications will appear.
Note also that even in the finite case SemiAlgebraic (or solve) will most probably fail if n is > 3 say.
Not to mention that the number of regions could be huge.

@TechnicalSupport 

You should also change
x(t), y(t); # plain x(t) and y(t)
to
x(u), y(u); # plain x(u) and y(u)
(or similar).

1. A typo:

soln := dsolve( sys ); # { x(t) = cos(t), y(t) = -sin(t) }
assign( sol );

Should be assign(soln). So,  x(t), y(t) are assigned but not as the desired procedures [remember tables; return the procnames]. Hence  x(u), y(u)  will not work.

2. @Carl
The type  Type is indeed very clever! Isn't idtype a better name for it?

@did 

I know it is simple, I have mentioned it. But you must use Taylor series, recognize the Fourier series and its convergence, integrate it. Using residues is even simpler.
But a CAS does not work as a human. Among other things, for integration it uses special functions. They have branches and so a lot of complications as in our case.

@did 

You have no choice. A perfect CAS does not exist and never will.

P.S. Fourier series? Trivial result?

@Carl Love 

gamma is known by the assume facility. So its tables contain the information.

about(gamma);
gamma:
  is assumed to be: gamma

 

 

@Markiyan Hirnyk 

The question was: why reject the 0 answer and accept the other one without some math investigations?
I think that Carl's suggestion (+ some evalf testss) is more reliable.

BTW. See this:

restart: 
int( exp((1+a+b*I)*exp(I*x)) , x=-Pi..Pi)  assuming real;  # a  and  b  are assumed to be real
simplify(%)  assuming real;

    0
    0

@Kitonum 

So, we have 2 symbolic results. How can we decide which one is true.  Is it always true? (e.g. a=0 in your answer).
Hard to answer without some maths.

 

@tomleslie 

can be found with a few computations by hand using the inequalities  u-1 < floor(u) <= u.
They can be obtained also like this:

 

S23:=[floor((1/2)*x1)+floor((1/5)*x2)+floor(-(2/9)*x1-(7/18)*x2+1/3)-8,
      floor((1/5)*x1)+floor((1/2)*x2)+floor(-(1/6)*x1-(7/24)*x2+3/4)-14]:

a:=eval(S23,floor=(t->t));

[(5/18)*x1-(17/90)*x2-23/3, (1/30)*x1+(5/24)*x2-53/4]

(1)

E:=[a[1]<=3,a[1]>=0, a[2]<=3, a[2]>=0];

[(5/18)*x1-(17/90)*x2 <= 32/3, 0 <= (5/18)*x1-(17/90)*x2-23/3, (1/30)*x1+(5/24)*x2 <= 65/4, 0 <= (1/30)*x1+(5/24)*x2-53/4]

(2)

evalf([eval(x1,simplex:-minimize(x1,E)),eval(x1,simplex:-maximize(x1,E))]);

[63.89610390, 82.46753247]

(3)

evalf([eval(x2,simplex:-minimize(x2,E)),eval(x2,simplex:-maximize(x2,E))]);

[51.81818182, 66.36363636]

(4)

 

 

Download bounds.mw

 

@Markiyan Hirnyk 

I think that the code for the projection and the regions are enough for this problem.
Any other solid people can start from here.

@Markiyan Hirnyk 

Yes, the MMA expression seems to be the same (the 13 regions), but that triangle is a nonsense. I am not sure about the boundary points.
The MMA projection  is:

@Markiyan Hirnyk 

A projection of a triangle is a triangle. As can be seen from the first plot (with code) this is false. So, MMA is totally wrong.

@Markiyan Hirnyk 

The MMA plot does not seem to be correct.
Can you plot the (x1,x2) projection?

The 13 regions obtained with Maple are:

Region1
{442/7 < x2, x1 < 80, x2 < 64, 381/2-(7/4)*x2 < x1}
Region2
{432/7 < x2, x1 < 78, x2 < 62, -(7/4)*x2+186 < x1}
Region3
{414/7 < x2, x1 < 78, x2 < 60, -(7/4)*x2+363/2 < x1}
Region4
{438/7 < x2, x1 < 75, x2 < 442/7, -(7/4)*x2+369/2 < x1}, {442/7 <= x2, x2 <= 444/7, 74 < x1, x1 < 75}, {x1 = 74, 442/7 < x2, x2 < 64}, {74 < x1, 444/7 < x2, x1 < -(7/4)*x2+186, x2 < 64}, {x1 = -(7/4)*x2+186, 444/7 < x2, x2 < 64}
Region5
{426/7 < x2, x1 < 75, x2 < 430/7, -(7/4)*x2+363/2 < x1}, {430/7 <= x2, 74 < x1, x1 < 75, x2 < 62}, {x1 = 74, 430/7 < x2, x2 < 62}
Region6
{410/7 < x2, x1 < 76, x2 < 414/7, -(7/4)*x2+357/2 < x1}, {414/7 <= x2, 75 < x1, x1 < 76, x2 < 60}, {x1 = 75, 414/7 < x2, x2 < 60}
Region7
{404/7 < x2, x1 < 76, x2 < 58, -(7/4)*x2+177 < x1}
Region8
{408/7 < x2, x1 < 75, x2 < 412/7, -(7/4)*x2+177 < x1}, {412/7 <= x2, x2 <= 414/7, 74 < x1, x1 < 75}, {x1 = 74, x2 <= 418/7, 412/7 < x2}, {74 < x1, 414/7 < x2, x1 < -(7/4)*x2+357/2, x2 < 418/7}, {x1 = -(7/4)*x2+357/2, 414/7 < x2, x2 < 418/7}
Region9
{x2 = 60, 147/2 < x1, x1 < 74}, {60 < x2, x1 < 74, x2 < 426/7, -(7/4)*x2+357/2 < x1}, {426/7 <= x2, x2 <= 430/7, 72 < x1, x1 < 74}, {x1 = 72, 426/7 < x2, x2 < 62}, {72 < x1, 430/7 < x2, x1 < -(7/4)*x2+363/2, x2 < 62}, {x1 = -(7/4)*x2+363/2, 430/7 < x2, x2 < 62}
Region10
{58 <= x2, 72 <= x1, x2 <= 412/7, x1 < 74}, {x1 = 72, 412/7 < x2, x2 < 60}, {72 < x1, 412/7 < x2, x1 < -(7/4)*x2+177, x2 < 60}, {x1 = -(7/4)*x2+177, 412/7 < x2, x2 < 60}
Region11
{56 <= x2, x2 <= 402/7, 70 < x1, x1 < 72}, {x1 = 70, 56 < x2, x2 < 58}, {70 < x1, 402/7 < x2, x1 < 345/2-(7/4)*x2, x2 < 58}, {x1 = 345/2-(7/4)*x2, 402/7 < x2, x2 < 58}
Region12
{x2 = 54, 70 <= x1, x1 < 72}, {x1 = 70, 54 < x2, x2 < 55}, {54 < x2, 70 < x1, x1 < 333/2-(7/4)*x2, x2 < 55}, {x1 = 333/2-(7/4)*x2, 54 < x2, x2 < 55}
Region13
{x2 = 56, 68 <= x1, x1 <= 137/2}, {x1 = 68, x2 <= 394/7, 56 < x2}, {56 < x2, 68 < x1, x1 < 333/2-(7/4)*x2, x2 < 394/7}, {x1 = 333/2-(7/4)*x2, 56 < x2, x2 < 394/7}

 

The correct 3d plot:

 

 

@Preben Alsholm 

To obtain the 1D version I have pasted the Int in a 2D execution group and then lprint(%).
BTW, the exact and approx value of the integral are computed below.
 

@Carl Love 

OP's function written in a natural and simplified form is

f:=piecewise(0<-w*x*y+u*x and -w*x*y+u*x<1,1)*piecewise(0<-w*x*y+v*y and-w*x*y+v*y<1,1) ;

Now,

int(f,  [x=0..1,y=0..1,u=0..1,v=0..1,w=0..1]);
       7/12

Converting to Heaviside
g:=convert(f,Heaviside);
       
g := Heaviside(-w*x*y+u*x)*Heaviside(-w*x*y+v*y)*Heaviside(w*x*y-u*x+1)*Heaviside(w*x*y-v*y+1)
int(g,  [x=0..1,y=0..1,u=0..1,v=0..1,w=0..1]);
    (interrupted)
but ...

int(g,  [u=0..1,v=0..1,w=0..1,x=0..1,y=0..1]);   # ok!
                               7/12

I wanted to check manually the result.
I was surprised to find that Maple is not able to solve the system

[0 < -w*x*y+u*x, -w*x*y+u*x < 1, 0 < -w*x*y+v*y, -w*x*y+v*y < 1, 0 < x, x < 1, 0 < y, y < 1, 0 < u, u < 1, 0 < v, v < 1, 0 < w, w < 1]

using solve, or SolveTools:-SemiAlgebraic

even if it's easy to see that the solution is:

0<x<1, 0<y<1, 0<w<1, w*y<u<1, w*x<v<1

so the integral is indeed
int((1-w*x)*(1-w*y), x=0..1, y=0..1, w=0..1) = 7/12.

 

 

First 81 82 83 84 85 86 87 Last Page 83 of 177