vv

9878 Reputation

18 Badges

5 years, 361 days

MaplePrimes Activity


These are answers submitted by vv

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)

 

 

F = 0, G = 0 is obviously a solution (gamma = anything).
Depending on your coefficients, this could be the only one.

A:=<-2,3,-5>: B:=<-6,1,-1>: C:=<2,-3,7>:
with(LinearAlgebra): local D:
k:=Norm(B-A,2) / Norm(C-A,2):
D:=(B + k*C)/(1+k);
eqAD:=A + t*(D-A); # parametric equation

The first problem is that you cannot have t=1:

fN(0.5, 1);
Error, (in solnproc) unable to compute solution for t>HFloat(0.2):
Newton iteration is not converging

So, let's take  t := 0.1;

It is not possible to compute the indefinite integral numerically. In your case, what you want is a definite integral.

t := 0.1;
                            t := 0.1

A1:=x*R(z)*R(z)*(fN)(x, t);
                A1 := 0.8692871388 x fN(x, 0.1)

A2:= X -> int(A1, x=0..X):
A2(0); # 0, as you want
                               0.

plot(A2, 0..1);

 

1 2 3 4 5 6 7 Last Page 1 of 96