vv

13805 Reputation

20 Badges

9 years, 311 days

MaplePrimes Activity


These are answers submitted by vv

# You must provide correct assumptions
restart;
with(inttrans):
#with(gfun);
#assume(alpha + beta = 1):
f := a*t^(-alpha) + b*t^(-beta):
inttrans[laplace](f, t, s) assuming alpha<1,beta<1;

      

This cannot be simplified, even if alpha+beta=1

P:=proc(pmax::posint)
   local p,q,u,v,n,sn, U, R, nR:=0;
   for q to pmax-1 do for p from q+1 to pmax do
     n:=p!/q!; sn:=isqrt(n);
     U:=NumberTheory:-Divisors(n);
     for u in U while u<sn do
       v:=n/u;
       if issqr((v-u)/2) then  nR:=nR+1; R[nR]:=[p, q, (u+v)/2, isqrt((v-u)/2)] fi;
     od:
   od od;
  print('num'=nR);
  entries(R, nolist)
  end proc:

P(13);
                            num = 56
[4, 1, 5, 1], [5, 1, 11, 1], [7, 1, 71, 1], [8, 1, 524, 22],  [8, 1, 204, 6], [8, 1, 201, 3], [9, 1, 684, 18], 
[11, 1, 7911, 69], [10, 1, 2304, 36], [3, 2, 2, 1], [12, 1, 22716, 78], [6, 2, 19, 1], [6, 2, 21, 3], 
[7, 2, 51, 3], [7, 2, 131, 11], [5, 3, 6, 2], [6, 3, 11, 1], [10, 2, 1620, 30], [11, 2, 4905, 45], [10, 3, 916, 22], 
[11, 3, 2956, 38], [7, 3, 29, 1], [8, 3, 104, 8], [8, 4, 76, 8], [13, 3, 32444, 62], [12, 3, 8935, 5], 
[12, 3, 12060, 90], [9, 4, 209, 13], [9, 4, 284, 16], [8, 4, 41, 1], [8, 4, 44, 4], [11, 5, 601, 13], 
[12, 5, 2511, 39], [13, 5, 10449, 87], [10, 6, 71, 1], [9, 4, 124, 4], [12, 4, 4905, 45], [8, 5, 31, 5], 
[9, 5, 55, 1], [11, 6, 236, 4], [11, 6, 244, 8], [11, 7, 336, 18], [8, 7, 3, 1], [11, 6, 431, 19], 
[11, 6, 2316, 48], [11, 6, 249, 9], [11, 6, 276, 12], [13, 8, 659, 23], [12, 9, 61, 7], [9, 8, 5, 2], 
[12, 8, 109, 1], [11, 7, 89, 1], [13, 7, 1231, 23],  [11, 7, 191, 13], [11, 7, 96, 6], [13, 9, 131, 1]
 


 

restart;
Digits:=10:
eq1:=5*(2.477538002*10^(-6)*a^2*b + 1.238769001*10^(-6)*b^3 - 1.761804802*10^(-10)*b)*sin(Upsilon) + 4.081436800*10^(-9)*a - 0.00001717419154*a^3:
eq2:=((2.642707202*10^(-10)*a*sigma + 3.320825870*10^(-8)*a + 1.0*(-3.716307003*10^(-6)*a*sigma - 0.0004669911380*a)*b^2 - 1.858153501*10^(-6)*a^3*sigma - 0.0002334955689*a^3)*sin(Upsilon) + 1.280000000*10^(-12)*(5.026400000*a*sigma + 631.6174240*a)*cos(Upsilon) + 1.280000000*10^(-12)*(1.352400000*sigma^2 + 339.8851680*sigma + 21354.98511)*b + 1.280000000*10^(-12)*(-8.114400000*sigma^4 - 4078.62201638042*sigma^3 - 768779.463909262*sigma^2 - 6.440321829*10^7*sigma - 2.023227102*10^9)*b^3)*csgn(sigma + 125.6600000) - 7.680000000*10^(-13)*(sigma + 125.6600000)^2*b:
eq3:=((1.238769001*10^(-6)*sigma + 0.0001556637127)*b^4 + ((2.477538002*10^(-6)*sigma - 0.0001556637126)*a^2 - 1.761804802*10^(-10)*sigma - 2.213883913*10^(-8))*b^2 - 0.0002334955690*a^4 + 3.320825870*10^(-8)*a^2)*cos(Upsilon) - 8.084703030*10^(-10)*a^2*sin(Upsilon) + (-0.00007783185636 - 2.477538002*10^(-6)*sigma)*a*b^3 + ((0.0003113274252 - 1.238769001*10^(-6)*sigma)*a^3 + (-1.106941957*10^(-8) + 1.761804802*10^(-10)*sigma)*a)*b + (1.286758400*10^(-9)*sigma^2 + 1.616940605*10^(-7)*sigma)*a*b:
sys:=simplify(10^6*[eq1,eq2,eq3]):

nops(sys), indets(sys,name);

3, {Upsilon, a, b, sigma}

(1)

sysr:=convert(sys, rational):

sysr1:=[  eval(sysr,[cos(Upsilon)=c, sin(Upsilon)=d, sigma=1/2])[],c^2+d^2-1 ];

[((66014/5329)*a^2*b+(33007/5329)*b^3-(1303/1479165)*b)*d+(1446/354287)*a-(109932/6401)*a^3, (-(617200709/1316416)*b^2*a+(8637242633/259062403668)*a-(6236490737/26603392)*a^3)*d+(21748019689/26793596995347)*a*c-(469710676743047585773/178516074749979120)*b^3+(73542825103094222810181170291200379/4797756380074395585228714044250000000)*b, ((8927965739/57126880)*b^4+(-(3081170479/19952544)*a^2-8769913225/394562518493)*b^2-(342538/1467)*a^4+(3487/105004)*a^2)*c-(551/681534)*a^2*d-(312269509/3949248)*a*b^3+((8874890483/28563440)*a^3+(26777240151757673/381510694941406250)*a)*b, c^2+d^2-1]

(2)

G:=Groebner:-Basis(sysr1, plex(c,d,a,b)):

nops(G);

8

(3)

indets~(G);

[{b}, {a, b}, {a, b}, {a, b, d}, {a, b, d}, {a, b, c, d}, {a, b, c, d}, {c, d}]

(4)

ab:=solve(G[1..3],explicit):

nops([ab])

3

(5)

evalf([ab]);

[{a = 0., b = 0.}, {a = 0.1542081633e-1, b = 0.2577584543e-2}, {a = -0.1542081633e-1, b = 0.2577584543e-2}]

(6)

eval(G, ab[1]);  #  So,  a=0, b=0, Upsilon=arbitrary

[0, 0, 0, 0, 0, 0, 0, c^2+d^2-1]

(7)

############

Digits:=100;

100

(8)

d1:=fsolve(eval(G[4], ab[2]));

0.1767112612192714286343873125631522838139889970508087652450952127061611264592773044391689682794290833e-1

(9)

fsolve(eval(G[5], ab[2])); %-d1;

0.1767112612192714286343873125631522838139889970508087652450952127047025878451866467897520588192095984e-1

 

-0.14585386140906576494169094602194849e-66

(10)

c1:=fsolve(eval(G[6], [ab[2][], d=d1]));

.9998438534599204826860536133197415830743820837843582966483442787543887342444801865403482145379307231

(11)

fsolve(eval(G[7], [ab[2][], d=d1])); %-c1;

.9998438534599204826860536133197415830743820837843582966483442787543887437298044097515800626952324576

 

0.94853242232112318481573017345e-71

(12)

c1^2+d1^2;

.9999999999999999999999999999999999999999999999999999999999999999999999810143670507891071664311474276

(13)

u1:=arctan(d1,c1);

0.1767204594111244839467484124914988636253117448309960560467697561494599646479420221269303132916932161e-1

(14)

d2:=fsolve(eval(G[4], ab[3]));

-0.1767112612192714286343873125631522838139889970508087652450952127061611264592773044391689682794290833e-1

(15)

fsolve(eval(G[5], ab[3])); %-d2;

-0.1767112612192714286343873125631522838139889970508087652450952127047025878451866467897520588192095984e-1

 

0.14585386140906576494169094602194849e-66

(16)

c2:=fsolve(eval(G[6], [ab[3][], d=d2]));

-.9998438534599204826860536133197415830743820837843582966483442787543887342444801865403482145379307231

(17)

fsolve(eval(G[7], [ab[3][], d=d2])); %-c2;

-.9998438534599204826860536133197415830743820837843582966483442787543887437298044097515800626952324576

 

-0.94853242232112318481573017345e-71

(18)

c2^2+d2^2;

.9999999999999999999999999999999999999999999999999999999999999999999999810143670507891071664311474276

(19)

u2:=arctan(d2,c2);

-3.123920607648680790067968542030352997834638224892006215370267616692870409821414796415341794012947746

(20)

 

Digits:=15:

Conclusion. The solutions of the system are:

[a=0, b=0, Upsilon=any]; [evalf(ab[2])[], Upsilon=evalf(u1)]; [evalf(ab[3])[], Upsilon=evalf(u2)];

[a = 0, b = 0, Upsilon = any]

 

[a = 0.154276352360907e-1, b = 0.257758454297948e-2, Upsilon = 0.176720459411124e-1]

 

[a = -0.154276352360907e-1, b = 0.257758454297948e-2, Upsilon = -3.12392060764868]

(21)

 


Download sys1-vv.mw

H0:=x->piecewise(x<=0,0,x<1/2,1,x<1,-1,0):
H_:=(k,m,x)-> H0(2^k*x-m):
H:=(n,x)->`if`(n=1,1, H_(ilog2(n), n-2^ilog2(n),x)):
seq(plot(H(n,x),x=0..1, color=red),n=1..7);

f:=(x^2)-6*x+p+3: g:=4*x^2-(p-8)*x+7:
minimize(f, x) = minimize(g, x)  assuming p::real;

           -6 + p = 4*(p/8 - 1)^2 - (p - 8)*(p/8 - 1) + 7

solve(%, p);
                            12, -12

It is a surprising bug. Maplesoft should fix it as soon as possible. (It probably comes due to the changes in add in Maple 2021).

A workaround is to replace add(p[], p=P)  with `+`(seq(p[], p=P));
Note that just adding compile=false (tom's suggestion)  is not enough, because removing the seq,  another error appears.

P := CartesianProduct([1,2,3,4],[1,2,3,4], compile=false);
#  seq(p[], p=P);
   add(p[], p=P);  # ==> error

 

The library must exist, or create a new one.

restart;
MyPackage := module() export f1, f2; local loc1; option package; 
  f1 := proc() loc1 end proc; 
  f2 := proc( v ) loc1 := v end proc; 
  loc1 := 2; 
end module:
mylib:="C:/tmp/test.mla";
LibraryTools:-Create(mylib);

#                   mylib := "C:/tmp/test.mla"

LibraryTools:-Save(MyPackage, mylib);
LibraryTools:-ShowContents(mylib); # optional
#    [["MyPackage.m", [2021, 9, 15, 12, 20, 8], 41984, 126]]

restart;
libname:=libname, "C:/tmp/test.mla":
with(MyPackage);
#                            [f1, f2]

f1();
#                               2

f2(123);
#                              123

f1();
#                              123

 

restart;
nat_param:=proc(ff, xx ::(name=anything), yy::(name=anything), t::name)
  local K,xt,yt, ode;
  xt:= diff(ff, op(1,xx)); 
  yt:= diff(ff, op(1,yy));
  K := 1/sqrt(xt^2 + yt^2);
  ode := {'diff'( op(1,xx),t ) = -K*yt, 'diff'( op(1,yy),t ) = K*xt};
  ode := subs( [op(1,xx)=op(1,xx)(t), op(1,yy)=op(1,yy)(t) ], ode);
  dsolve(ode union {op(1,xx)(0)=op(2,xx), op(1,yy)(0)=op(2,yy)},numeric, output=listprocedure);
  eval([lhs(xx(t)),lhs(yy(t))],%)[]
end:

f:=x1^4 + x2^4 + 0.4*sin(7*x1) + 0.3*sin(4*Pi*x2) - 1: 
xx,yy:=nat_param(f, x1=0,x2=1, t):
L:=fsolve(xx(t)=xx(0),t=8..10): N:=6:
plots:-display(seq(plot([xx,yy,k*L/N..(k+1)*L/N],color=COLOR(HUE,k/(N+2))), k=0..N-1), thickness=6);

op(1, xLp_tmp)

 

It's a bug (but actually the generators are correct).

restart;
with(GroupTheory):
H:=PermutationGroup({[[2, 3], [4, 5]], [[2, 5], [3, 4]]}, degree = 5, supergroup = PermutationGroup({[[2, 3, 4]], [[1, 2], [4, 5]]}, degree = 5));
#                    H := ((23)(45)(25)(34))

MinPermRepDegree(H);
#"GENS" = [[Perm([[1, 2]])], [Perm([[3, 4]])]]

#Error, (in GroupTheory:-Subgroup) not all the provided generators belong to the group

Workaround:

GroupOrder(H);
 #                              4

H1:=DirectProduct(CyclicGroup(2)$2):
AreIsomorphic(H, H1);
#                              true

MinimumPermutationRepresentationDegree(H1);
#"GENS" = [[Perm([[1, 2]])], [Perm([[3, 4]])]]

#                               4

 

The command GroupTheory:-IdentifySmallGroup identifies a group returning (n,d) where n is its order and d an integer (1 <= d <= NumGroups(n)). Then inspect https://en.wikipedia.org/wiki/List_of_small_groups

The computation is slow on my (old) computer. It needs several hours.
To  interrupt and then continue later, just save the partial results. 

restart;
read "d:/temp/Jfile.mpl";
max(indices(J,nolist));
smax := 20;  R := 1680;  k := 1/4;  gam := 1/2;    vmax:=R/2;
n:=0;
Digits:=15:
f:=proc(v,s) 
  evalf(Re(  sinh(s)*coth(1/2*s)^(2*I/k)/(gam-I*k*cosh(s))^5*exp(-(k^2*sinh(s)^2/(gam-I*
  k*cosh(s))+I*k*(1-cosh(s)))*v)*Hypergeom([I/k],[1],I*k*v)*v^n  ))
end:
V0:=0;  dV:=20;  # <-----
for V from V0 to vmax-dV by dV do
  J[V]:=evalf(1/R * Int(f, [V..V+dV, 0..smax], method=_CubaCuhre, epsilon=1e-5));
od;
save J, "d:/temp/Jfile.mpl";
add(entries(J,nolist));
max(indices(J,nolist));

Similar for the imaginary part if needed.

 

restart;

`simplify/JacobiP`:=proc(ex::algebraic)
  evalindets(ex, specfunc({int,Int}),
    proc(J)
      local J11,J12, n,a,b,x, m;
      if not type(op(1,J), `*`) then return J fi;
      J11:=select(type, [op(op(1,J))], specfunc(JacobiP)^2 );
      J12:=select(type, [op(op(1,J))], specfunc(JacobiP));
      if not(J11<>[] xor J12<>[]) or nops(J11)>1 then return J fi;
      if J11<>[] then J12:=[op([1,1],J11)$2] fi;
      if nops(J12)<>2 or op(J12[1])[2..] <> op(J12[2])[2..] then return J fi;
      n,a,b,x := op(J12[1]); m:=op(1,J12[2]);
      if  not mul(J12)*(1-x)^a*(1+x)^b = op(1,J) or not (op(-1,J) = (x=-1..1))   then return  J fi;
      piecewise(m<>n, 0, 2^(a+b+1)*GAMMA(n+a+1)*GAMMA(n+b+1)/((2*n+a+b+1)*GAMMA(n+a+b+1)*n!))
    end proc
  )
end proc:

 

# Examples

J:=Int(JacobiP(n, a, b, x)*JacobiP(m, a, b, x)*(1 - x)^a*(1 + x)^b, x=-1..1):

simplify(J, JacobiP);

piecewise(m <> n, 0, 2^(a+b+1)*GAMMA(n+a+1)*GAMMA(n+b+1)/((2*n+a+b+1)*GAMMA(n+a+b+1)*factorial(n)))

(1)

J:=Int(JacobiP(n, a, b, x)*JacobiP(m, a, b, x)*(1 - x)^a*(1 + x)^b, x=-1..100):

simplify(J, JacobiP);

Int(JacobiP(n, a, b, x)*JacobiP(m, a, b, x)*(1-x)^a*(1+x)^b, x = -1 .. 100)

(2)

J:=Int(JacobiP(n, a, b, x)^2*(1 - x)^a*(1 + x)^b, x=-1..1);

Int(JacobiP(n, a, b, x)^2*(1-x)^a*(1+x)^b, x = -1 .. 1)

(3)

simplify(J, JacobiP);

2^(a+b+1)*GAMMA(n+a+1)*GAMMA(n+b+1)/((2*n+a+b+1)*GAMMA(n+a+b+1)*factorial(n))

(4)

J:=int(JacobiP(3, a, b, x)*JacobiP(n, a, b, x)*(1 - x)^a*(1 + x)^b, x=-1..1);

int(JacobiP(3, a, b, x)*JacobiP(n, a, b, x)*(1-x)^a*(1+x)^b, x = -1 .. 1)

(5)

simplify(J, JacobiP);

piecewise(n <> 3, 0, 2^(a+b+1)*GAMMA(4+a)*GAMMA(4+b)/((6*(7+a+b))*GAMMA(4+a+b)))

(6)

simplify((J+1)^2+exp(7*x), JacobiP);

(piecewise(n <> 3, 0, 2^(a+b+1)*GAMMA(4+a)*GAMMA(4+b)/((6*(7+a+b))*GAMMA(4+a+b)))+1)^2+exp(7*x)

(7)

simplify((J+1)^2+exp(7*x), JacobiP) assuming n>3;

1+exp(7*x)

(8)

 


Download SimpJP-vv.mw

                      

 

restart;

d2:=(A,B)-> (A[1]-B[1])^2 + (A[2]-B[2])^2:
area:=(A,B,C) -> LinearAlgebra:-Determinant( <Matrix([A,B,C])|<1,1,1>> )/2:

A:=[0,0];
M:=[0,-7/sqrt(2)];
N:=[0,7/sqrt(2)];
S:=[7/sqrt(2),0];
P:=M+11/7*(S-M);

[0, 0]

 

[0, -(7/2)*2^(1/2)]

 

[0, (7/2)*2^(1/2)]

 

[(7/2)*2^(1/2), 0]

 

[(11/2)*2^(1/2), 2*2^(1/2)]

(1)

T:=P+k*~(N-P);
k:=solve( T[1]^2+T[2]^2-49/2 )[2];

[-(11/2)*k*2^(1/2)+(11/2)*2^(1/2), (3/2)*k*2^(1/2)+2*2^(1/2)]

 

44/65

(2)

B:=[x,y]: solve([d2(B,T)=d2(B,P),d2(B,P)=d2(B,S)],[x,y]):
B:=eval([x,y],%[]);

[(7/2)*2^(1/2), 2*2^(1/2)]

(3)

Q:=2*B-P;

[(3/2)*2^(1/2), 2*2^(1/2)]

(4)

#plot([M,N,P,Q,M]);

Area__MNPQ = area(Q,N,M)+area(Q,P,N);

Area__MNPQ = 33/2

(5)

 

 

First 22 23 24 25 26 27 28 Last Page 24 of 120