vv

13977 Reputation

20 Badges

10 years, 38 days

MaplePrimes Activity


These are answers submitted by vv

Just add

dsolve({ entries(de, nolist), x__1(0)=0, x__2(0)=10, D(x__1)(0)=0, D(x__2)(0)=0 }) ;

Note that I have included initial conditions for derivatives, otherwise two arbitrary constants appear.

The minimal correction would be to replace both rand(1..6);  with rand(1..6)();
That's because rand(1..6)  is a procedure and must be called to produce a random number in the interval 1..6.

It will work, but this way each time you call it, the two procedures are created and then called.
A more efficient way is to define

dice := rand(1..6), rand(1..6);   # or better  rand(1..6) $2

Now dice is no longer a procedure but acts exactly the same, i.e. 
dice() ;
       6, 4

 

 

Try this one

COEFF:=(f, z) -> `if`(has(z,`&*`), coeff(args), coeff(eval(f,`&*`=0),z,_rest));

 

subsindets(p, [0,algebraic], u -> NULL);

You have an inequality in the system, so the variables will be assumed to be real.
Your system is hence polynomial and Maple should use SolveTools:-SemiAlgebraic, which usually gives correct answers.
Unfortunately, due to the presence of abs, the system is not recognized as polynomial.
So, use simplify first.
 

eq:=[a>0,b*d*(abs(c)^2-abs(a)^2) = 0, -a*c*(abs(b)^2-abs(d)^2) = 0, -abs(b)^2*a*d+abs(d)^2*b*c = 0, abs(c)^2*a*d-abs(a)^2*b*c = 0]:
eq1:=simplify(eq) assuming real:
solve(eq1);

{b = -d, c = -a, 0 < a, d < 0}, {b = 0, c = 0, d = d, 0 < a}, {b = d, c = a, 0 < a, d < 0}, {b = 0, d = 0, 0 < a, c < -a}, {b = 0, c = -a, d = 0, 0 < a}, {b = 0, d = 0, 0 < a, c < 0, -a < c}, {c = 0, d = 0, 0 < a, b < 0}, {c = 0, d = 0, 0 < a, 0 < b}, {b = 0, d = 0, 0 < a, 0 < c, c < a}, {b = 0, c = a, d = 0, 0 < a}, {b = 0, d = 0, 0 < a, a < c}, {b = -d, c = -a, 0 < a, 0 < d}, {b = d, c = a, 0 < a, 0 < d}

 

Replace vector with Vector.
(vector is deprecated).
If you insist with vector then change the last line from out to eval(out).

P.S. base should be close to 1 (e.g. base=1.01), otherwise the sequence increases too fast.

evalb checks syntactically and does not simplify, see ?evalb.  Use

is(a * conjugate(a) = abs(a) ^ 2);
or                            
evalb(simplify(a * conjugate(a) = abs(a) ^ 2));
 

 

It seems to be a bug and Maple enters an infinite loop.
Execute
infolevel[`mod`]:=2;
and see the messages.

Edit. But it might just working hard. Maxima also fails.
Where have you obtained a factorization?

 

Here is the answer for the Hausdorff measure (corresponds to the length).

Unfortunately Maple reveals some bugs for symbolic integration!

 

 

restart;

dS:=sqrt(a^2*sin(t)^2+b^2*cos(t)^2):
S :=(t1,t2) -> Int( dS, t=t1..t2 ):

Mean:= (t1,t2) -> Int( sqrt(a^2*cos(t)^2+b^2*sin(t)^2)*dS, t=t1..t2 )/S(t1,t2):

 

Examples

 

### 1 ###
ans:=eval(Mean(0,Pi), [a=2,b=1]);

(Int((4*cos(t)^2+sin(t)^2)^(1/2)*(4*sin(t)^2+cos(t)^2)^(1/2), t = 0 .. Pi))/(Int((4*sin(t)^2+cos(t)^2)^(1/2), t = 0 .. Pi))

(1)

simplify(value(ans));  # Maple bug

0

(2)

evalf(ans);

1.463684753

(3)

### 2 ###

ans:=eval(Mean(Pi/4,3*Pi/2), [a=2,b=1]);

(Int((4*cos(t)^2+sin(t)^2)^(1/2)*(4*sin(t)^2+cos(t)^2)^(1/2), t = (1/4)*Pi .. (3/2)*Pi))/(Int((4*sin(t)^2+cos(t)^2)^(1/2), t = (1/4)*Pi .. (3/2)*Pi))

(4)

simplify(value(ans)); evalf(%);  # another bug!!!

(5*EllipticK((1/4)*3^(1/2)*5^(1/2))+(25*I)*EllipticK(1/4)-(16*I)*EllipticE(1/4)+(4*I)*EllipticE(4)-(4*I)*EllipticE((1/2)*I, 4)+(20*I)*EllipticF((1/2)*I, 4)-10)/(16*EllipticE((1/2)*2^(1/2), (1/2)*3^(1/2))+32*EllipticE((1/2)*3^(1/2)))

 

-.2882716323+.3166809263*I

(5)

evalf(ans);

1.406678625

(6)

### 3 ###

ans:=eval(Mean(Pi/4,3*Pi/2), [a=1,b=1]);  # circle, finally bug-free

(Int(cos(t)^2+sin(t)^2, t = (1/4)*Pi .. (3/2)*Pi))/(Int((cos(t)^2+sin(t)^2)^(1/2), t = (1/4)*Pi .. (3/2)*Pi))

(7)

simplify(value(ans)); evalf(%);

1

 

1.

(8)

evalf(ans);

1.000000000

(9)

 

 

ans:=rsolve({f(1) = 1, f(n+1) = 1/2*(f(n)+9/f(n))}, {f});

3*coth((1/2)*arccoth(1/3)*2^n)

(1)

# It's nice that Maple did it!

ans1:=simplify(convert(ans,compose,ln,exp)) assuming posint, n>1;

(3*2^(2^(-1+n))+3)/(2^(2^(-1+n))-1)

(2)

#(Not valid for n=1)

 

Edit for a simpler version

# Check
F:=n -> 1/2*(F(n-1)+9/F(n-1)): F(1):=1:
seq([F(n), ans1],n=1..7);


[1, 9], [5, 5], [17/5, 17/5], [257/85, 257/85], [65537/21845, 65537/21845], [4294967297/1431655765, 4294967297/1431655765], [18446744073709551617/6148914691236517205, 18446744073709551617/6148914691236517205]

 

Find the group generated in GL(2,Q) by the matrices A, B:

restart;

A :=  Matrix(2, 2, [[2, 0], [0, 1]]) ;

B := Matrix(2, 2, [[1, 1], [0, 1]]) ;

Matrix(2, 2, {(1, 1) = 2, (1, 2) = 0, (2, 1) = 0, (2, 2) = 1})

 

Matrix(%id = 18446744074411464574)

(1)

pow:=LinearAlgebra:-MatrixPower:

pow(A,n);

Matrix(2, 2, {(1, 1) = 2^n, (1, 2) = 0, (2, 1) = 0, (2, 2) = 1})

(2)

pow(B,n);

Matrix(2, 2, {(1, 1) = 1, (1, 2) = n, (2, 1) = 0, (2, 2) = 1})

(3)

pow(A,m).pow(B,n).pow(A,p).pow(B,q);

Matrix(2, 2, {(1, 1) = 2^m*2^p, (1, 2) = 2^m*2^p*q+2^m*n, (2, 1) = 0, (2, 2) = 1})

(4)

It will be easy now to see that the group generated by A and B is  { X(a,b,c) : a,b,c in Z }, where

 

 

X(a,b,c) =  <2^a, 2^b*c; 0, 1>;

X(a, b, c) = (Matrix(2, 2, {(1, 1) = 2^a, (1, 2) = 2^b*c, (2, 1) = 0, (2, 2) = 1}))

(5)

In Maple permutations have posint entries. You must shift them by 1.

restart;
with(group):
a:=[[seq(i,i=1..6)],[seq(i,i=7..9)]];

              a := [[1, 2, 3, 4, 5, 6], [7, 8, 9]]
mulperms(a,a);
               [[1, 3, 5], [2, 4, 6], [7, 9, 8]]
b:=a:
for i to 6 do
  lprint('a'^i=b);
  b:=mulperms(b,a);
od:

a = [[1, 2, 3, 4, 5, 6], [7, 8, 9]]
a^2 = [[1, 3, 5], [2, 4, 6], [7, 9, 8]]
a^3 = [[1, 4], [2, 5], [3, 6]]
a^4 = [[1, 5, 3], [2, 6, 4], [7, 8, 9]]
a^5 = [[1, 6, 5, 4, 3, 2], [7, 9, 8]]
a^6 = []

 

 The behavior seems to be intentional (but not documented) being useful for boolean expressions containing variables.
Such expressions are simplified generically for boolean operators  but are left unsimplified for the corresponding procedures.

restart;
x := a=0:  y := b=0:

eval(`or`(x,y), [a=0]);   evalb(%);
                         0 = 0 or b = 0
                              true
eval(x or y, [a=0]);   # generically false, so the substitution is useless
                             false

 

A "sequential order" does not have much sense in Maple because e.g. a unique ordering of the operands in sum or product is not possible.
For the set of all functions use:

map2(op,0,indets(expr,function));

 

I had the impression that posting the complete Maple solution is not very interesting (the 13 regions were already listed).

The idea of the solution is simple: obtain the explicit values for the six floors (after some simplifications).

However it seems that there are interested users here, so here it is. I have inserted a minimum of comments

 

 

restart;

S0:=[4*x1+7*x2+6*x3 - 186, floor((1/2)*x1)+floor((1/5)*x2)+floor((1/3)*x3) - 18,
floor((1/5)*x1)+floor((1/2)*x2)+floor((1/4)*x3) - 21];

[4*x1+7*x2+6*x3-186, floor((1/2)*x1)+floor((1/5)*x2)+floor((1/3)*x3)-18, floor((1/5)*x1)+floor((1/2)*x2)+floor((1/4)*x3)-21]

(1)

id:=t->t:

Suv:=eval(S0,floor=id)-[0,3*u,3*v];

[4*x1+7*x2+6*x3-186, -3*u+(1/2)*x1+(1/5)*x2+(1/3)*x3-18, -3*v+(1/5)*x1+(1/2)*x2+(1/4)*x3-21]

(2)

3u and 3v  are the sum of the fractional parts in the 2nd and 3rd equation;  0 <= u,v < 1

 

#Suv:=[4*x1+7*x2+6*x3-186, (1/2)*x1+(1/5)*x2+(1/3)*x3-18-3*u, (1/5)*x1+(1/2)*x2+(1/4)*x3-21-3*v]

xuv:=solve(Suv,[x1,x2,x3])[];

[x1 = 4920/77+(750/77)*u+(680/77)*v, x2 = -(120/77)*u+4110/77+(1000/77)*v, x3 = -(1620/77)*v-5688/77-(360/77)*u]

(3)

Suv:=eval(S0,xuv)[2..3];

[floor(73/77+(375/77)*u+(340/77)*v)-2+floor(-(24/77)*u+52/77+(200/77)*v)+floor(-(540/77)*v+29/77-(120/77)*u), floor(60/77+(150/77)*u+(136/77)*v)-2+floor(-(60/77)*u+53/77+(500/77)*v)+floor(-(405/77)*v+41/77-(90/77)*u)]

(4)

Suv  is the new system in the unknowns u,v.  The relations with the initial system is below (uvx).

uvx:=solve(xuv[1..2],{u,v});

{u = -(17/270)*x2-23/9+(5/54)*x1, v = (1/90)*x1-53/12+(5/72)*x2}

(5)

Now Suv can be solved easily because the floors may take only a few values.

A:=eval(indets(Suv[1])minus{u,v},floor=id)[];
B:=eval(indets(Suv[2])minus{u,v},floor=id)[];

73/77+(375/77)*u+(340/77)*v, -(24/77)*u+52/77+(200/77)*v, -(540/77)*v+29/77-(120/77)*u

 

60/77+(150/77)*u+(136/77)*v, -(60/77)*u+53/77+(500/77)*v, -(405/77)*v+41/77-(90/77)*u

(6)

Min:=f -> min(eval(f,[u=0,v=0]), eval(f,[u=0,v=1]), eval(f,[u=1,v=0]), eval(f,[u=1,v=1]));
Max:=f -> max(eval(f,[u=0,v=0]), eval(f,[u=0,v=1]), eval(f,[u=1,v=0]), eval(f,[u=1,v=1]));

proc (f) options operator, arrow; min(eval(f, [u = 0, v = 0]), eval(f, [u = 0, v = 1]), eval(f, [u = 1, v = 0]), eval(f, [u = 1, v = 1])) end proc

 

proc (f) options operator, arrow; max(eval(f, [u = 0, v = 0]), eval(f, [u = 0, v = 1]), eval(f, [u = 1, v = 0]), eval(f, [u = 1, v = 1])) end proc

(7)

SA, SB  will contain the possible floors

SA:=NULL:
for i from floor(Min(A[1])) to  floor(Max(A[1])) do
for j from floor(Min(A[2])) to  floor(Max(A[2])) do
for k from floor(Min(A[3])) to  floor(Max(A[3])) do
if i+j+k=2 then SA:=SA,[i,j,k] fi
od od od:
nops([SA]);

38

(8)

SB:=NULL:
for i from floor(Min(B[1])) to  floor(Max(B[1])) do
for j from floor(Min(B[2])) to  floor(Max(B[2])) do
for k from floor(Min(B[3])) to  floor(Max(B[3])) do
if i+j+k=2 then SB:=SB,[i,j,k] fi
od od od:
nops([SB]);

33

(9)

NR:=0:
for sa in [SA] do for sb in [SB] do
sa[1]<=A[1],A[1]<sa[1]+1, sa[2]<=A[2],A[2]<sa[2]+1, sa[3]<=A[3],A[3]<sa[3]+1,
sb[1]<=B[1],B[1]<sb[1]+1, sb[2]<=B[2],B[2]<sb[2]+1, sb[3]<=B[3],B[3]<sb[3]+1;
ss:=solve(eval({%},uvx));    # nu e nevoie sa includem  0<=u<1, 0<=v<1  caci le-am folosit deja in Min.Max
if [ss]<>[] then NR:=NR+1;R[NR]:=ss; fi
od od:  NR;

13

(10)

We have ontained the NR=13 regions.  Here is the first one

R[1];

{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}

(11)

Now  plots:-inequal is able to plot the regions (projected on the (x1,x2) plane).

proj:=plots:-display( seq(  plots:-inequal({R[r]},x1=67..81,x2=53..65), r=1..NR), size=[800,800] );

 

#proj:=plots:-display( seq(  plots:-inequal({R[r]},x1=67..81,x2=53..65,
#optionsclosed=[color=red,thickness=4], optionsopen=[color=white,thickness=0]), r=1..NR), size=[800,800] );

 

# List all 13 regions
for r to NR do lprint(Region||r=[R[r]]) od:

Region1 = [{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}]

Region2 = [{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}]
Region3 = [{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}]
Region4 = [{58 <= x2, 72 <= x1, x2 <= 412/7, x1 < 74}, {x1 = 72, 412/7 < x2, x2 < 60}, {72 < x1, 412/7 < x2, x1 < 177-(7/4)*x2, x2 < 60}, {x1 = 177-(7/4)*x2, 412/7 < x2, x2 < 60}]
Region5 = [{x2 = 60, 147/2 < x1, x1 < 74}, {60 < x2, x1 < 74, x2 < 426/7, 357/2-(7/4)*x2 < x1}, {426/7 <= x2, x2 <= 430/7, 72 < x1, x1 < 74}, {x1 = 72, 426/7 < x2, x2 < 62}, {72 < x1, 430/7 < x2, x1 < 363/2-(7/4)*x2, x2 < 62}, {x1 = 363/2-(7/4)*x2, 430/7 < x2, x2 < 62}]
Region6 = [{408/7 < x2, x1 < 75, x2 < 412/7, 177-(7/4)*x2 < 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 < 357/2-(7/4)*x2, x2 < 418/7}, {x1 = 357/2-(7/4)*x2, 414/7 < x2, x2 < 418/7}]
Region7 = [{404/7 < x2, x1 < 76, x2 < 58, 177-(7/4)*x2 < x1}]
Region8 = [{410/7 < x2, x1 < 76, x2 < 414/7, 357/2-(7/4)*x2 < x1}, {414/7 <= x2, 75 < x1, x1 < 76, x2 < 60}, {x1 = 75, 414/7 < x2, x2 < 60}]
Region9 = [{426/7 < x2, x1 < 75, x2 < 430/7, 363/2-(7/4)*x2 < x1}, {430/7 <= x2, 74 < x1, x1 < 75, x2 < 62}, {x1 = 74, 430/7 < x2, x2 < 62}]
Region10 = [{438/7 < x2, x1 < 75, x2 < 442/7, 369/2-(7/4)*x2 < x1}, {442/7 <= x2, x2 <= 444/7, 74 < x1, x1 < 75}, {x1 = 74, 442/7 < x2, x2 < 64}, {74 < x1, 444/7 < x2, x1 < 186-(7/4)*x2, x2 < 64}, {x1 = 186-(7/4)*x2, 444/7 < x2, x2 < 64}]
Region11 = [{414/7 < x2, x1 < 78, x2 < 60, 363/2-(7/4)*x2 < x1}]
Region12 = [{432/7 < x2, x1 < 78, x2 < 62, 186-(7/4)*x2 < x1}]
Region13 = [{442/7 < x2, x1 < 80, x2 < 64, 381/2-(7/4)*x2 < x1}]

 

Plotting the 3d regions is now easy.

f23 := plottools:-transform((x1,x2) -> [x1,x2,-2*x1*(1/3)-7*x2*(1/6)+31]):

plots:-display(f23(proj));

 

 


 

Download sysfloor-sent.mw

First 64 65 66 67 68 69 70 Last Page 66 of 120