vv

12453 Reputation

19 Badges

9 years, 279 days

MaplePrimes Activity


These are answers submitted by vv

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);

 

Actually the equation  chi(i) = a (a>=0) may have up to 4 solutions. (The first one for i<=0.)

restart

p := proc (S) options operator, arrow; .32*exp(S)/(1.2+1.901885*exp(S)-S^3) end proc

proc (S) options operator, arrow; .32*exp(S)/(1.2+1.901885*exp(S)-S^3) end proc

(1)

eta := proc (S) options operator, arrow; (D(p))(S)*S/p(S) end proc

proc (S) options operator, arrow; (eval(diff(p(x), x), x = S))*S/p(S) end proc

(2)

f := proc (k) options operator, arrow; A*k^alpha end proc

proc (k) options operator, arrow; A*k^alpha end proc

(3)

w := proc (k) options operator, arrow; f(k)-(D(f))(k)*k end proc

proc (k) options operator, arrow; f(k)-(eval(diff(f(x), x), x = k))*k end proc

(4)

beta := 1

1

(5)

A := 28

28

(6)

alpha := .33

.33

(7)

chi := proc (i) options operator, arrow; i*((1+beta)/beta+eta(i))/(1+eta(i)) end proc

proc (i) options operator, arrow; i*((1+beta)/beta+eta(i))/(1+eta(i)) end proc

(8)

#ss:=simplify(chi(i));

#plot(ss, i=-2..18)

#sort(select(u -> Im(u)=0,[solve(ss,i),solve(1/ss,i)]));

#select(u -> (u>6), [solve(diff(ss,i),i)]);

ii:=[-1.059280978, -0.7553094684, 0, 3.612421353, 6.399747910, 9.270348450, 9.270348450, 50]:

chin:=proc(a)
  local b:= evalf(RootOf(200000*_Z^5 - 200000*_Z^4*a - 200000*_Z^4 + 400000*_Z^3*a - 760754*exp(_Z)*_Z + 380377*exp(_Z)*a - 240000*_Z^2 + 240000*_Z*a - 480000*_Z + 240000*a, _Z, ii[2*n-1] .. ii[2*n]));
`if`(b::numeric,b,undefined)
end:

NULL

Hn:=k -> chin(w(k)):
Vn := k -> ln((w(k) - Hn(k))*(A*alpha)^beta*(p(Hn(k))*Hn(k))^(alpha*beta)):

for n from 1 to 4 do
  plot(Vn, 1 .. 2, title=Plot||n);
od;

Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct

 

 

 

 

 


Download Worksheet_1_vv.mw

If you really want to create the (global) m||i variables even when they exist, just replace

M := [seq(m || i, i = 2 .. l)];

with

M := [seq(evaln(m || i), i = 2 .. l)];


 

It's a quadratic equation. Just use solve.

solve((a*y-x*(a+1))/(x^(2)-b*a^(2)*(y-x)^(2))=A, y);

 

First 14 15 16 17 18 19 20 Last Page 16 of 111