vv

14027 Reputation

20 Badges

10 years, 43 days

MaplePrimes Activity


These are answers submitted by vv

The Maple implementation NumberTheory:-Totient is of course faster (for large numbers), but the simplest one is probably:

eulerphi:=(n::posint) -> add(`if`(igcd(k,n)=1,1,0),k=1..n);

 

Should be

solve(SysEqE,{diff(phi[1](t),t),diff(phi[3](t),t)});

op(0,a);

But you should try to see how this appeared, because it is a nonsense (probably from a programming error).

I don't think it has a special name; it is a multiplication by a diagonal matrix.

But are you sure it is useful? AFAIK the eigenvector algorithms always do a row (or column) normalization.

Use
evalc(Re(expr));

 

restart;

eq1 := diff(u1(x), x, x)+diff(u2(x), x)+int(2*x*s*(u1(s)-3*u2(s)), s = 0 .. 1) = 6*x^2+3*x*(1/10)+8;
eq2 := diff(u1(x), x)+diff(u2(x), x, x)+int((3*(s^2+2*x))*(u1(s)-2*u2(s)), s = 0 .. 1) = 21*x+4/5;
bcs := u1(0)+(D(u1))(0) = 1, u2(0)+(D(u2))(0) = 1, u1(1)+(D(u1))(1) = 10, u2(1)+(D(u2))(1) = 7;

EQ1 := diff(u1(x), x, x)+diff(u2(x), x)+a*x = 6*x^2+3*x*(1/10)+8;
EQ2 := diff(u1(x), x)+diff(u2(x), x, x)+b*x+c = 21*x+4/5;

diff(diff(u1(x), x), x)+diff(u2(x), x)+int(2*x*s*(u1(s)-3*u2(s)), s = 0 .. 1) = 6*x^2+(3/10)*x+8

 

diff(u1(x), x)+diff(diff(u2(x), x), x)+int(3*(s^2+2*x)*(u1(s)-2*u2(s)), s = 0 .. 1) = 21*x+4/5

 

u1(0)+(D(u1))(0) = 1, u2(0)+(D(u2))(0) = 1, u1(1)+(D(u1))(1) = 10, u2(1)+(D(u2))(1) = 7

 

diff(diff(u1(x), x), x)+diff(u2(x), x)+a*x = 6*x^2+(3/10)*x+8

 

diff(u1(x), x)+diff(diff(u2(x), x), x)+b*x+c = 21*x+4/5

(1)

sol:=dsolve({EQ1,EQ2},{u1(x),u2(x)}):

U1:=unapply( eval(u1(x),sol),x):
U2:=unapply( eval(u2(x),sol),x):

sys:=eval([(lhs-rhs)(eq1),(lhs-rhs)(eq2),bcs],[u1=U1,u2=U2]):

map(coeffs,sys,x):

consts:=solve(%):

SOL:=simplify(eval(sol,consts));

{u1(x) = (-55897*exp(1-x)+27844*exp(2-x)+35538*exp(1+x)+(229194*x^2+1583820*x-1422696)*exp(1)+(-45192*x^2-385320*x+335340)*exp(2)-300822*x^2-1458780*x-55263*exp(x)+1319226)/(-49980*exp(2)+232200*exp(1)-250080), u2(x) = (-55897*exp(1-x)+27844*exp(2-x)-35538*exp(1+x)+(464400*x^3-681738*x^2+1399212*x-1095936)*exp(1)+(-99960*x^3+160164*x^2-309456*x+259476)*exp(2)-500160*x^3+669894*x^2-1398996*x+55263*exp(x)+1038390)/(-49980*exp(2)+232200*exp(1)-250080)}

(2)

U1:=unapply( eval(u1(x),SOL),x):             # Check
U2:=unapply( eval(u2(x),SOL),x):             #
simplify(eval({eq1,eq2,bcs},[u1=U1,u2=U2])); #

{1 = 1, 7 = 7, 10 = 10, 21*x+4/5 = 21*x+4/5, 6*x^2+(3/10)*x+8 = 6*x^2+(3/10)*x+8}

(3)

 


Download sysode-int.mw

 

n is supposed to be a positive integer.

We compute the indefinite integral.

 

 

J:=n -> Int((2*cos(Pi*x*n/T)^2-1)*sin(Pi*x*n/T)*cos(Pi*x*n/T)/(sin(Pi*x/T)*cos(Pi*x/T)), x);

proc (n) options operator, arrow; Int((2*cos(Pi*x*n/T)^2-1)*sin(Pi*x*n/T)*cos(Pi*x*n/T)/(sin(Pi*x/T)*cos(Pi*x/T)), x) end proc

(1)

value(combine(J(n+1)-J(n)));

(1/2)*T*sin(2*Pi*x*(2*n+1)/T)/(Pi*(2*n+1))

(2)

K:=unapply(%,n);

proc (n) options operator, arrow; (1/2)*T*sin(2*Pi*x*(2*n+1)/T)/(Pi*(2*n+1)) end proc

(3)

J(n)=value(J(1))+Sum(K(k),k=1..n-1);  # Answer

Int((2*cos(Pi*x*n/T)^2-1)*sin(Pi*x*n/T)*cos(Pi*x*n/T)/(sin(Pi*x/T)*cos(Pi*x/T)), x) = -x+2*T*((1/2)*cos(Pi*x/T)*sin(Pi*x/T)+(1/2)*Pi*x/T)/Pi+Sum((1/2)*T*sin(2*Pi*x*(2*k+1)/T)/(Pi*(2*k+1)), k = 1 .. n-1)

(4)

value(%);  # Version of the answer

int((2*cos(Pi*x*n/T)^2-1)*sin(Pi*x*n/T)*cos(Pi*x*n/T)/(sin(Pi*x/T)*cos(Pi*x/T)), x) = -x+2*T*((1/2)*cos(Pi*x/T)*sin(Pi*x/T)+(1/2)*Pi*x/T)/Pi+((1/8)*I)*T*(exp((2*I)*Pi*x*(2*n+1)/T)*LerchPhi(exp((4*I)*Pi*x/T), 1, n+1/2)-exp((6*I)*Pi*x/T)*LerchPhi(exp((4*I)*Pi*x/T), 1, 3/2)+exp(-(6*I)*Pi*x/T)*LerchPhi(exp(-(4*I)*Pi*x/T), 1, 3/2)-LerchPhi(exp(-(4*I)*Pi*x/T), 1, n+1/2)*exp(-(2*I)*Pi*x*(2*n+1)/T))/Pi

(5)

simplify(diff( (lhs-rhs)(%), x)); # Check

0

(6)

This is a maths problem, not a Maple one. See https://en.wikipedia.org/wiki/Cycles_and_fixed_points

Of course it is easy to implement any of the formulae.

Here is a direct solution (based on simplex) asked by the OP who has an older version of Maple.

FacetsOfPolyhedralCone:=proc(L::list)
local i,j,J,A,X,u;
X:=indets(L,name);
A:=LinearAlgebra:-GenerateMatrix(L,X)[1]:
J:={seq(1..nops(L))}:
for j in J do
  add(A[j]-u[i]*A[i],i=J minus {j}); convert(%,list)=~0;
  if simplex[minimize](0, %, NONNEGATIVE) <>{} then J:=J minus {j} fi;
od:
J, L[[J[]]];
end:

L := [y-z, 3*y-2*z, 2*y-2*z, x-2*y+z, x-y, 2*x-y, x-z, x+y-z, x, y, z]:  # >= 0

FacetsOfPolyhedralCone(L);
      
{3, 4, 11}, [2*y-2*z, x-2*y+z, z]

solve({x[5] = x[2]/x[1], x[6] = x[3]/x[2], x[7] = x[1]/x[4],
       x[8] = (2*x[2]+x[4])/(2*x[1]+x[3]+x[4])}, {x[1], x[2], x[3], x[4]}); 

         {x[1] = 0, x[2] = 0, x[3] = 0, x[4] = 0}

It is a bug. The result of eliminate should be:

Mathematically it should be also added: x[5]<>0, x[7]<>0, x[4]<>0,  x[6] <> -(2*x[7]+1)/(x[5]*x[7])

@mmcdara 

Let's do the computations for 3 digits.

restart;
Digits:=3:
a,b,c:= sqrt~([2,3,6])[]:
fa,fb,fc := evalf(%);

                 fa, fb, fc := 1.41, 1.73, 2.45
fa*fb;
                              2.44
# Do you expect  2.45?  How?
141*173;
                             24393

 

 

num1dsubspaces := (p,n) -> (p^n - 1)/(p-1)

 

ineqs:=
y-z >=0,
3*y-2*z >=0,
2*y-2*z >=0,
x-2*y+z >=0,
x-y >=0,
2*x-y >=0,
x-z >=0,
x+y-z >=0,
x>=0,
y>=0,
z>=0:
with(PolyhedralSets):
A := PolyhedralSet([ineqs]);
B := PolyhedralSet([ineqs[3..4],ineqs[-3..-1]]);

evalb(convert(A,string)=convert(B,string));

        true

Add:

f1,f2,f3:=seq(unapply('evalf'(x__||i),t2), i=1..3):
plot([f1,f2,f3], 0..0.2);

You will not be able to plot over  0 .. Pi/2  because the integrals are not convergent here.

First 77 78 79 80 81 82 83 Last Page 79 of 121