vv

14187 Reputation

20 Badges

10 years, 280 days

MaplePrimes Activity


These are answers submitted by vv

You have used square brackets [...]  in eqn1. Replace them with (...)  because [...]  are reserved for lists.

P.S. Spor la treabă!

The best thing is to eliminate yourself the extra vectors due to inherent roundoff errors.
(all vectors after an almost-null one are not reliable).

GS_sel := proc(GS,eps:=1e-7)
  local zer:=false, s;
  s:=proc(v) if zer then NULL elif LinearAlgebra:-Norm(v)>eps then v else zer:=true; NULL fi end;
  map(s,GS)
end:

GS_sel(GramSchmidt([b, c, d, e, a]));

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

 

First 65 66 67 68 69 70 71 Last Page 67 of 122