vv

13922 Reputation

20 Badges

10 years, 8 days

MaplePrimes Activity


These are answers submitted by vv

For container structures (such as tables, rtables) use e.g. EqualEntries  (or LinearAlgebra:-Equal(...), or ...)

EqualEntries(Matrix([[1,2],[1,2]]), <1,2;1,2>);

        true

The equation has a unique real solution, so, "Diophantine" is not essential.

restart;
f:=419*x^2 + 116*x*y - 426*x*z + 78*y^2 - 142*y*z + 133*z^2 - 1604*x - 682*y + 1086*z + 2306:
CS:=Student:-Precalculus:-CompleteSquare:
CS(f,z):
f1:=select(has,[op](%), z)[]:
CS(f-f1,y):
f2:=select(has,[op](%), y)[]:
f3:=CS(expand(f-f1-f2),x):
expand(f-f1-f2-f3);
solve([f1,f2,f3]);

          0
          {x = 7, y = 11, z = 13}

By Dirichlet's theorem on arithmetic progressions - Wikipedia there are infinitely many primes of the form 24*n + 1.
p,q can be any pair of these.

P.S. We could avoid Dirichlet' theorem noting that at least one of the sets {24*n+k| n in N} for k=0,1,...,23   must contain infinitely many primes.

You want the limit of V for beta --> oo. Use:

limit(V, beta = infinity)

It results 6.5.

If you want to check this numerically for large values for beta (as you did), increase first Digits e.g.

Digits := 30;

P.S. Note that usually, for symbolic computations like limit, it is recommended to use exact values or rational values for parameters.

The extra question is not clear enough (for me).

restart;

y:=x -> cos(a*x)+cos(x):

#  Suppose y is periodic with period T. ==>

y(T)=y(0);

cos(a*T)+cos(T) = 2

(1)

solve(op([1,1],%) =1, T, allsolutions) = solve(op([1,2],%) =1, T, allsolutions)

2*Pi*_Z1/a = 2*Pi*_Z2

(2)

a=solve(%, a);

a = _Z1/_Z2

(3)

# Impossible, `a` being irrational!

 

 

Download periodic-vv.mw

Maple does not use LeafCount for the complexity.

length~([e1,e2]);  # same complexity

                     [21, 21]

Better use ifactors:

SumPrimeFactors := n -> add(map2(op,1,ifactors(n)[2])):

 

Your matrix m  is positive semidefinite. But if we compute M := evalf(m) it will become indefinite (due to roundoff errors.)

On the other hand for such M  and a given permutation matrix P, the LDLt factorization of P^+ .M.P may not exist, so the behavior you describe is normal.

The error given by Maximize is clear:
Error, (in Optimization:-NLPSolve) no feasible point found for the linear constraints

Indeed, C_1, and C_2 imply:

C12:=op(C_1 union C_2):
solve(C12[1]);solve(C12[2]);

                  [36571.46530, infinity)

               (-infinity, 27143.30624]

so, disjoint intervals, no common point (i.e. no feasible point).

 

Re(term2) assuming real;
combine(%);

        

 

It is not possible to use an index this way:
a[i] := expr;
==> a table named a is constructed and the entry i is defined.
If i is symbolic, all the other entries such as a[1], a[2], ... remain undefined.

It is possible to use a procedure

a := i -> expr;

and use paranteses a(1), a(2), ...

 

Here is a method to define a function using your infinite product.

 

restart

# An approximation

N:=100:
f:=t -> local n;  evalf(mul(2*cos(t/2^n)-1, n=1..N));

proc (t) local n; options operator, arrow; evalf(mul(2*cos(t/2^n)-1, n = 1 .. N)) end proc

(1)

plot(f, -5..5);

 

# Exact computation; Maple is not able to obtain it. We have to use the brain or (maybe) IA.

F:= t -> sin(3*t/2)/3/sin(t/2);

proc (t) options operator, arrow; (1/3)*sin((3/2)*t)/sin((1/2)*t) end proc

(2)

plot(F-f, -5..5)

 


Download inf-prod-vv.mw

A table has special evaluation (to a name). So, use:

eval(T1["1"]);

Also, print(T1["1"]); confirms.

restart;

limit( cos(Pi*sqrt(x^2+x+1)), x=infinity);

-1 .. 1

(1)

 

The limit does not exist for a function, but it exists for a sequence.

 

L := Limit(cos(Pi*sqrt(n^2+n+1)), n=infinity); # assuming n::integer

Limit(cos(Pi*(n^2+n+1)^(1/2)), n = infinity)

(2)

f := asympt(sqrt(n^2+n+1),n,2, oterm=false);

n+1/2+(3/8)/n

(3)

simplify(cos(f*Pi)) assuming n::posint;

L=limit(%, n=infinity);

-sin((3/8)*Pi/n)*(-1)^n

 

Limit(cos(Pi*(n^2+n+1)^(1/2)), n = infinity) = 0

(4)

 

 

See the 2018 post  add, floats, and Kahan sum - MaplePrimes.

Note that since 2021, the add command has the pairwise option, see Pairwise summation - Wikipedia.

 

 

Let us check the provided manual solution.

 

de := Diff(a(x)*Diff(u(x),x),x) = -1;

Diff(a(x)*(Diff(u(x), x)), x) = -1

(1)

bc := u(-1)=0, u(1)=0;

u(-1) = 0, u(1) = 0

(2)

a := x -> 1 + 2*Heaviside(x);

proc (x) options operator, arrow; 1+2*Heaviside(x) end proc

(3)

c := int(x/a(x),x=-1..1) / int(1/a(x),x=-1..1) ;

-1/4

(4)

U:=int((c-xi)/a(xi), xi=-1..x); # the "solution" u(x) = U

-(1/4)*x+(1/6)*x*Heaviside(x)-(1/2)*x^2+(1/3)*x^2*Heaviside(x)+1/4

(5)

eval(U, x=1), eval(U, x=-1);  # bc, OK

0, 0

(6)

U is continuous everywhere, differentiable except at x=0.

value(eval(lhs(de), u(x)=U)) assuming x<0;
value(eval(lhs(de), u(x)=U)) assuming x>0

-1

 

-1

(7)

So, the provided solution U, is continuous in [-1,1],  not differentiable at 0 but C^2 in [-1,1] \ {0} and satisfies the de  here.
It seems to be a "generalized" solution, but the exact sense is not mentioned. Distributional sense maybe?

 

Unfortunately the documentation for dsolve is silent about this type of ode.
Is this solution acceptable for you?

Anyway, it is not a big surprise that dsolve has problems.

 

[edited]

 

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