vv

12453 Reputation

19 Badges

9 years, 278 days

MaplePrimes Activity


These are answers submitted by vv

Technically, you must use:

U,S,Vt := SingularValues(A, output=[':-U',':-S',':-Vt']);

(Of course, in your example, this does not make much sense because U, S, Vt are not needed/used.)

restart;
a:=floor(33*sqrt(3)):
R2:=33^2*3:  # the radius^2
L2:=R2*16/6: # the edge^2
nr:=0: W:=Array(1..0):
for  x from 0 to a do
for  y from x to a do
for  z from y to a do
if x^2+y^2+z^2=R2 then nr++: W(nr):=[x,y,z] fi
od od od:
f:=u -> ([u[1],u[2],u[3]], [-u[1],u[2],u[3]],[u[1],-u[2],u[3]], [u[1],u[2],-u[3]],
        [-u[1],-u[2],u[3]], [-u[1],u[2],-u[3]],[u[1],-u[2],-u[3]], [-u[1],-u[2],-u[3]]):
P:=f~([seq](W)): # the integer points on the sphere
n:=nops(P);
#                            n := 96

d2 :=(u,v) -> inner(u-v,u-v):
A:=Matrix( n, (i,j)-> `if`(d2(P[i],P[j])=L2, 1, 0) ):
with(GraphTheory):
G:=Graph(A):
K4 := CompleteGraph(4):
IsSubgraphIsomorphic(K4,G, isomorphism);
#             true, {1 = 95, 2 = 94, 3 = 93, 4 = 89}

T := P[[rhs~(%[2])[]]]; # A desired tetrahedron
# T := [ [33, 33, 33], [-33, -33, 33], [-33, 33, -33], [33, -33, -33]  ]

plots:-display(plottools:-tetrahedron(T), plottools:-sphere([0, 0, 0], sqrt(R2), transparency=0.8), color="Blue");

The floor method cannot work because NLPSolve finds only local extrema and almost any point is a local max,
actually any point in ( (-5, oo) \ Z )^9.

The DirectSearch package (in Application Center) works, but the solution is of course not guaranteed.

GlobalOptima(add(x[k],k=1..9), 
   [seq(x[k]::integer, k=1..9),seq(x[k]<=x[k+1], k=1..8), x[1]>=-5, x[9]<=50, add(x[k]^3,k=1..9)=0],
   evaluationlimit=50000, maximize);

     [12., [x[1] = -4, x[2] = 2, x[3] = 2, x[4] = 2, x[5] = 2, x[6] = 2, x[7] = 2, x[8] = 2, x[9] = 2], 2169]

No, such polynomial would have been found by solve.
(You have a Hermite interpolation problem here!)

ex:=F(u^(1/n), v^(1/n))^n - F(u, v):
ex1:=eval(ex, [u=exp(-A), v=exp(-B)]):
expand(simplify(ex1)) assuming positive;  # 0

 

Just use ReducedRowEchelonForm and append the identity matrix to your square matrix.

 

restart;

with(LinearAlgebra):

n:=3:

A:=RandomMatrix(n);

Matrix(3, 3, {(1, 1) = 27, (1, 2) = 99, (1, 3) = 92, (2, 1) = 8, (2, 2) = 29, (2, 3) = -31, (3, 1) = 69, (3, 2) = 44, (3, 3) = 67})

(1)

LinearAlgebra:-ReducedRowEchelonForm(<A|IdentityMatrix(n)>);

Matrix(3, 6, {(1, 1) = 1, (1, 2) = 0, (1, 3) = 0, (1, 4) = -3307/327244, (1, 5) = 2585/327244, (1, 6) = 5737/327244, (2, 1) = 0, (2, 2) = 1, (2, 3) = 0, (2, 4) = 2675/327244, (2, 5) = 4539/327244, (2, 6) = -1573/327244, (3, 1) = 0, (3, 2) = 0, (3, 3) = 1, (3, 4) = 1649/327244, (3, 5) = -5643/327244, (3, 6) = 9/327244})

(2)

B:=%[..,n+1..];

Matrix(3, 3, {(1, 1) = -3307/327244, (1, 2) = 2585/327244, (1, 3) = 5737/327244, (2, 1) = 2675/327244, (2, 2) = 4539/327244, (2, 3) = -1573/327244, (3, 1) = 1649/327244, (3, 2) = -5643/327244, (3, 3) = 9/327244})

(3)

A.B; #check

 

Matrix(3, 3, {(1, 1) = 1, (1, 2) = 0, (1, 3) = 0, (2, 1) = 0, (2, 2) = 1, (2, 3) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 1})

(4)

 

 

You just need a pencil for this.

c=5, a=12/2=6, b^2 = a^2 - c^2 = 11 

So, x^2/36 + y^2/11 = 1.

 

I see the QuantifierElimination package (new in Maple 2023) as experimental.
Here is a much simpler problem and the solution obtained by  QuantifierElimination.

 

restart;

with( QuantifierElimination );

[CylindricalAlgebraicDecompose, DeleteFormula, InsertFormula, PartialCylindricalAlgebraicDecompose, QuantifierEliminate, QuantifierTools]

(1)

f:=(x-1)/(x^2+x+1);

(x-1)/(x^2+x+1)

(2)

fmax:=evala(maximize(f));

-1+(2/3)*3^(1/2)

(3)

forall(x, f <= K);

forall(x, (x-1)/(x^2+x+1) <= K)

(4)

sol:=QuantifierEliminate( % ); ### ?

And(Or(And(-K <= 0, Or(K <> 0, And(2*K <= 1, Or(2*K-1 <> 0, And(-K <= 0, Or(K <> 0, And(K <= 0, Or(K <> 0, -K < 1)))))))), And(K = 0, K-1 = 0, K+1 = 0)), Or(K <> 0, K <= 1, -K^5-2*K^4-4*K^3-6*K^2-3*K < 0, And(K^3+2*K^2+K = 0, K^2+3 <> 0)), Or(K <> 0, -K <= -1, -K^5-2*K^4-4*K^3-6*K^2-3*K < 0, And(K^3+2*K^2+K = 0, K^2+3 <> 0)), Or(K <> 0, K-1 = 0, And(-K^5-2*K^4-4*K^3-6*K^2-3*K <= 0, Or(K^5+2*K^4+4*K^3+6*K^2+3*K <> 0, And(2*K^5+7*K^4+6*K^2-18*K <= -3, Or(2*K^5+7*K^4+6*K^2-18*K+3 <> 0, And(-K^3-3*K^2-5*K <= -1, Or(K^3+3*K^2+5*K-1 <> 0, And(2*K^3+5*K^2-8*K <= -1, Or(2*K^3+5*K^2-8*K+1 <> 0, -K < 0)))))))), And(K = 0, K-1 = 0, K+1 = 0)), Or(-K <= 0, -3*K^2-6*K <= -1, -3*K^3+K^2 < 0, K^3 <> 0), Or(K <= 0, -3*K^2-6*K <= -1, -3*K^3+K^2 < 0, K^3 <> 0), Or(K <= 0, 3*K^2+6*K-1 <> 0, 3*K^2-K <> 0), Or(K <> 0, -K <= -1, And(-K^5-2*K^4-4*K^3-6*K^2-3*K <= 0, Or(K^5+2*K^4+4*K^3+6*K^2+3*K <> 0, And(2*K^5+7*K^4+6*K^2-18*K <= -3, Or(2*K^5+7*K^4+6*K^2-18*K+3 <> 0, And(-K^3-3*K^2-5*K <= -1, Or(K^3+3*K^2+5*K-1 <> 0, And(2*K^3+5*K^2-8*K <= -1, Or(2*K^3+5*K^2-8*K+1 <> 0, -K < 0)))))))), And(K = 0, K-1 = 0, K+1 = 0)), Or(K <= 0, -3*K^2-6*K <= -1, 3*K^3-K^2 < 0, K^3 <> 0), Or(-K <= 0, -3*K^2-6*K <= -1, 3*K^3-K^2 < 0, K^3 <> 0), Or(-K <= 0, 3*K^2+6*K-1 <> 0, 3*K^2-K <> 0), Or(K <= 0, -3*K^2-6*K <= -1, And(Or(3*K^3+6*K^2-K <= 0, 3*K^5+6*K^4-K^3 <= 0), Or(-3*K^2+K < 0, And(3*K^3+6*K^2-K <= 0, -3*K^5-6*K^4+K^3 <= 0)), Or(9*K^5+15*K^4-9*K^3+K^2 < 0, 3*K^5+6*K^4-K^3 <> 0, And(Or(2*K^2+5*K <= 1, K^3+5*K^2+6*K <= 1), 2*K^2+5*K <= 1, -K^3-5*K^2-6*K <= -1, Or(-2*K^2-5*K < -1, K^3+5*K^2+6*K-1 <> 0, And(Or(-K <= 0, 4*K^3+8*K^2-K <= 0), Or(K < 0, And(-K <= 0, -4*K^3-8*K^2+K <= 0)), Or(K^2 < 0, 4*K^3+8*K^2-K <> 0, -K < 0)))))), And(K = 0, K-1 = 0, K+1 = 0)), Or(-K <= 0, -3*K^2-6*K <= -1, And(Or(-3*K^3-6*K^2+K <= 0, -3*K^5-6*K^4+K^3 <= 0), Or(3*K^2-K < 0, And(-3*K^3-6*K^2+K <= 0, 3*K^5+6*K^4-K^3 <= 0)), Or(9*K^5+15*K^4-9*K^3+K^2 < 0, 3*K^5+6*K^4-K^3 <> 0, And(Or(-2*K^2-5*K <= -1, -K^3-5*K^2-6*K <= -1), Or(-2*K^2-5*K < -1, K^3+5*K^2+6*K-1 <> 0, And(Or(K <= 0, -4*K^3-8*K^2+K <= 0), Or(-K < 0, And(K <= 0, 4*K^3+8*K^2-K <= 0)), Or(K^2 < 0, 4*K^3+8*K^2-K <> 0, -K < 0)))))), And(K = 0, K-1 = 0, K+1 = 0)), Or(-K <= 0, -3*K^2-6*K <= -1, And(Or(-3*K^3-6*K^2+K <= 0, -3*K^5-6*K^4+K^3 <= 0), Or(-3*K^2+K < 0, And(-3*K^3-6*K^2+K <= 0, 3*K^5+6*K^4-K^3 <= 0)), Or(-9*K^5-15*K^4+9*K^3-K^2 < 0, 3*K^5+6*K^4-K^3 <> 0, And(Or(-2*K^2-5*K <= -1, -K^3-5*K^2-6*K <= -1), -2*K^2-5*K <= -1, K^3+5*K^2+6*K <= 1, Or(2*K^2+5*K < 1, K^3+5*K^2+6*K-1 <> 0, And(Or(K <= 0, -4*K^3-8*K^2+K <= 0), Or(K < 0, And(K <= 0, 4*K^3+8*K^2-K <= 0)), Or(-K^2 < 0, 4*K^3+8*K^2-K <> 0, -K < 0)))))), And(K = 0, K-1 = 0, K+1 = 0)), Or(K = 0, -3*K^2-6*K < -1, And(Or(3*K^4+6*K^3-K^2 <= 0, 3*K^6+6*K^5-K^4 <= 0), Or(-3*K^3+K^2 < 0, And(3*K^4+6*K^3-K^2 <= 0, -3*K^6-6*K^5+K^4 <= 0)), Or(9*K^5+15*K^4-9*K^3+K^2 < 0, 3*K^5+6*K^4-K^3 <> 0, And(Or(2*K^3+5*K^2-K <= 0, K^4+5*K^3+6*K^2-K <= 0), Or(K < 0, And(2*K^3+5*K^2-K <= 0, -K^4-5*K^3-6*K^2+K <= 0)), Or(-2*K^2-5*K < -1, K^3+5*K^2+6*K-1 <> 0, And(Or(-K^2 <= 0, 4*K^4+8*K^3-K^2 <= 0), Or(K^2 < 0, And(-K^2 <= 0, -4*K^4-8*K^3+K^2 <= 0)), Or(K^2 < 0, 4*K^3+8*K^2-K <> 0, -K < 0)))))), And(K = 0, K-1 = 0, K+1 = 0)), Or(K <= 0, -3*K^2-6*K <= -1, And(Or(3*K^3+6*K^2-K <= 0, 3*K^5+6*K^4-K^3 <= 0), Or(3*K^2-K < 0, And(3*K^3+6*K^2-K <= 0, -3*K^5-6*K^4+K^3 <= 0)), Or(-9*K^5-15*K^4+9*K^3-K^2 < 0, 3*K^5+6*K^4-K^3 <> 0, And(Or(2*K^2+5*K <= 1, K^3+5*K^2+6*K <= 1), Or(2*K^2+5*K < 1, K^3+5*K^2+6*K-1 <> 0, And(Or(-K <= 0, 4*K^3+8*K^2-K <= 0), Or(-K < 0, And(-K <= 0, -4*K^3-8*K^2+K <= 0)), Or(-K^2 < 0, 4*K^3+8*K^2-K <> 0, -K < 0)))))), And(K = 0, K-1 = 0, K+1 = 0)))

(5)

should_be = (K >= fmax);   # !!

should_be = (-1+(2/3)*3^(1/2) <= K)

(6)

is(eval(sol, K=fmax));            # ckeck

is(eval(sol, K=fmax-10^(-20)));   #

true

 

false

(7)

 

N.B. Why do you use such an unusual UserProfile?  The output of   2*x + 30  is:

 

The system is not very simple, but I agree that SolveTools:-SemiAlgebraic is very slow in general, and I had not the patience for a result.

Anyway, the result (for eq1) seems to be (and is confirmed by MMA):

a := RootOf(_Z^3 - 4*_Z^2 - 27, 5.054 .. 5.063):
sol := {z=0, y = x, a < x}, {y=0, z = x, a < x}, {x=0, y = z, a < z};

plots:-spacecurve([[t,t,0], [t,0,t], [0,t,t]], t=a..3*a, color=[red,blue,green], thickness=5);

Can the equation (x-a)^4 + (x-b)^4 = c have four different integer solutions,where  a, b, c  are integers?

 

The answer is NO.  Actually not even four real solutions!

Suppose the polynomial  f := (x-a)^4 + (x-b)^4 - c  has 4 real solutions. After a shift, we may suppose that one of the solutions is 0, so c = a^4 + b^4,  a, b nonzero.

 

restart;

f := (x-a)^4 + (x-b)^4 - a^4 - b^4;

(x-a)^4+(x-b)^4-a^4-b^4

(1)

factor(f);

-2*x*(a+b-x)*(2*a^2-2*a*b-a*x+2*b^2-b*x+x^2)

(2)

 

f1:=op(-1,%);

2*a^2-2*a*b-a*x+2*b^2-b*x+x^2

(3)

f1  must have two real solutions

d1:=discrim(f1,x); # should be >0. But

-7*a^2+10*a*b-7*b^2

(4)

d2:=discrim(%,a);  # should be >= 0 (otherwise d2<0 implies d1<0).  ==>

-96*b^2

(5)

b:=0;  # contradiction.

0

(6)

solve(f1,x);  # Actually:

(1/2+((1/2)*I)*7^(1/2))*a, (1/2-((1/2)*I)*7^(1/2))*a

(7)

# Contradiction. Q.E.D.

 

The procedure ALG works only for finite sets! Actually, the support for infinite sets in Maple is very limited, see ?SetOf.

[0,2] is a list, not an interval. [0,1) is a nonsense in Maple (for 1D input).

Note also that ALG computes the algebra generated by C, not the sigma-algebra; of course, X, C must be finite, so this is the same thing.

You cannot solve such theoretical problems using Maple. You cannot even formulate them within Maple, because a CAS does other things!

But your problem is very simple if you know basic measure theory:

If A is a Borel subset in R^n and  g : A --> R  and  h : R^n \ A  --> R are continuous
then the function f : R^n --> R,  f(x) = g(x), if x in A, and f(x) = h(x), if x in R^n \ A
is a Borel function.

In your example, A = {(0,0)}; in your previous version A = {0} x R.

Use:

LEN:=proc(s::string) Python:-EvalFunction("len",s) end proc:

It works for utf-8 characters, used by Maple, see https://mapleprimes.com/posts/214347-Multibyte-Characters

For example

LEN("România"); #  7

Note that the solution proposed by mmcdara works only for characters coded with at most 2 bytes. 

Use instead:

LC := proc(expr)
local i;
  if type(expr, {numeric,name,string}) then return 1  # or maybe atomic
  else add(i, i = map(thisproc,[op(expr)]))  +  1
  end if
end proc;


 

Everything is correct, even for a without assumptions (i.e. for any complex a).

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