Kitonum

21435 Reputation

26 Badges

17 years, 24 days

MaplePrimes Activity


These are answers submitted by Kitonum

Using nested loops, we find 1170 solutions. Your example is on the 578th place:

restart;
f:=x->(a*x^2 + b*x + c)/(d*x^2 + e*x + m):
g:=x->d*x^2 + e*x + m:
k:=0:
for a from 1 to 10 do
for b from 1 to 10 do
for c from 1 to 10 do
for d from 1 to 10 do
for e from 1 to 10 do
for m from 1 to 10 do
N:=numer(diff(f(x),x)):
A:=coeff(N,x^2); B:=coeff(N,x); C:=coeff(N,x,0);
disc:=B^2-4*A*C:
if A<>0 and disc>0 and type(sqrt(disc),integer) then x1:=(-B+sqrt(disc))/2/A: x2:=(-B-sqrt(disc))/2/A;
if type(x1,integer) and type(x2,integer) and g(x1)<>0 and g(x2)<>0 then if type(f(x1),integer) and type(f(x2),integer)   then
k:=k+1; L[k]:=[a,b,c,d,e,m] fi; fi; fi;
od: od: od: od: od: od:
L:=convert(L, list):
nops(L);
ListTools:-Search([5,8,2,2,6,5],L);  
                            

                                                                        1170
                                                                         578

restart;
z1:=x1+I*y1: z2:=x2+I*y2: z3:=x3+I*y3:
simplify(evalc(abs(z1+z2+z3)), evalc(map(t->t^2,{abs(z1)=1,abs(z2)=2,abs(z3)=3,abs(9*z1*z2+4*z1*z3+z2*z3)=12}))):
simplify(%);

                                                               2

 

These 2 files are not loaded. See below my program that solves the problem in a couple of seconds:

restart;
p:=2: k:=0:
while k<10000 do
if isprime(p+36) then k:=k+1; L[k]:=p fi;
p:=nextprime(p);
od:
L:=convert(L,list):

nops(L);
L[-1];

 

"Warning" is not a bug, but a warning. Your real mistake is that it should be  L[k*n]  and  L[n]  instead of  L__k*n  and  L__n. This is not visible in 2d math and I had to convert your code to 1d math to find and fix this error of yours.

restart; 
Eratosthenes := proc(N::posint) 
local L, primeslist, n, k; 
description "Calculate all primes less than or equal to N"; 
L := Array(2 .. N, i->true); 
for n from 2 to trunc(sqrt(N)) do 
if L[n] = true then 
for k from n while k*n <= N do 
L[k*n] := false od; fi; 
od; 
primeslist := NULL; 
for n from 2 to N do 
if L[n] = true then 
primeslist := primeslist, n fi; 
od; 
primeslist;
end proc:

Eratosthenes(32);

                             2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31

You have a system of 11 equations with 11 unknowns, but you are trying to solve it for only a part of the unknowns, obviously considering the rest of the unknowns as parameters. This way you end up with an overridden system that is usually inconsistent. If you use the  solve command to all 11 unknown, the program hangs. The  fsolve  command gives one solution:

restart;
Sys:={-mu*a[1]+2*c[2]*a[1]*a[2]^2-a[1]*k^2*c[1]+2*c[2]*a[1]*a[0]^2+5*c[4]*a[0]^4*a[1]+5*c[4]*a[1]*a[2]^4+3*c[3]*a[1]*a[2]^2+3*c[3]*a[0]^2*a[1]+a[1]*c[1]+30*c[4]*a[0]^2*a[1]*a[2]^2-20*c[4]*a[1]*a[2]*a[0]^3-4*c[2]*a[1]*a[0]*a[2]-8*c[2]*a[1]^3*A*B+24*c[1]*a[1]*A*B-6*c[3]*a[0]*a[1]*a[2]-20*c[4]*a[0]*a[1]*a[2]^3+48*c[2]*a[1]*a[0]^2*A*B+176*c[2]*a[1]*a[2]^2*A*B-224*c[2]*a[1]*A*B*a[0]*a[2] = 0, -16*c[2]*a[1]^3-6*mu*a[1]+156*c[2]*a[1]*a[2]^2-6*a[1]*k^2*c[1]-20*c[2]*a[1]*a[0]^2+30*c[4]*a[0]^4*a[1]-20*c[4]*a[1]^3*a[2]^2+30*c[4]*a[1]*a[2]^4-6*c[3]*a[1]*a[2]^2+18*c[3]*a[0]^2*a[1]+20*c[4]*a[0]^2*a[1]^3+c[4]*a[1]^5+2*a[1]^3*c[3]-10*a[1]*c[1]-60*c[4]*a[0]^2*a[1]*a[2]^2-24*c[2]*a[1]^3*A*B+8*c[1]*a[1]*A*B+16*c[2]*a[1]*a[0]^2*A*B+336*c[2]*a[1]*a[2]^2*A*B+352*c[2]*a[1]*A*B*a[0]*a[2] = 0, -32*c[2]*a[2]*a[0]^2*A*B-8*c[2]*a[1]^2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4]+a[2]^5*c[4]-k^2*a[0]*c[1]-k^2*a[2]*c[1]+a[0]^3*c[3]+3*a[0]^2*a[2]*c[3]+3*a[0]*a[2]^2*c[3]+a[2]^3*c[3]-mu*a[0]-mu*a[2] = 0, 5*a[0]^4*a[1]*c[4]+20*a[0]^3*a[1]*a[2]*c[4]+30*a[0]^2*a[1]*a[2]^2*c[4]+20*a[0]*a[1]*a[2]^3*c[4]+5*a[1]*a[2]^4*c[4]-k^2*a[1]*c[1]+2*a[0]^2*a[1]*c[2]+3*a[0]^2*a[1]*c[3]+4*a[0]*a[1]*a[2]*c[2]+6*a[0]*a[1]*a[2]*c[3]+2*a[1]*a[2]^2*c[2]+3*a[1]*a[2]^2*c[3]-mu*a[1]+a[1]*c[1] = 0, 5*a[0]^5*c[4]+15*a[0]^4*a[2]*c[4]+10*a[0]^3*a[1]^2*c[4]+10*a[0]^3*a[2]^2*c[4]+30*a[0]^2*a[1]^2*a[2]*c[4]-10*a[0]^2*a[2]^3*c[4]+30*a[0]*a[1]^2*a[2]^2*c[4]-15*a[0]*a[2]^4*c[4]+10*a[1]^2*a[2]^3*c[4]-5*a[2]^5*c[4]-5*k^2*a[0]*c[1]-3*k^2*a[2]*c[1]+5*a[0]^3*c[3]-16*a[0]^2*a[2]*c[2]+9*a[0]^2*a[2]*c[3]+6*a[0]*a[1]^2*c[2]+3*a[0]*a[1]^2*c[3]-32*a[0]*a[2]^2*c[2]+3*a[0]*a[2]^2*c[3]+6*a[1]^2*a[2]*c[2]+3*a[1]^2*a[2]*c[3]-16*a[2]^3*c[2]-a[2]^3*c[3]-5*mu*a[0]-3*mu*a[2]-8*a[2]*c[1] = 0}:
nops(Sys);
indets(Sys);
fsolve(Sys);

                                                     11
                     {A, B, k, mu, a[0], a[1], a[2], c[1], c[2], c[3], c[4]}
               {A = -1.372706307, B = 2.529830542, k = -1.759770235, mu = 0.,  a[0] = -2.269126642, a[1] = 0.,          a[2] = -6.833450316, c[1] = 0., c[2] = 0., c[3] = 0., c[4] = 0.}
 

Maple's complete solutions often look too long. You can ask Maple to show only 2 integrations by parts using the  IntegrationTools:-Parts  command. You must specify u-term every time:

restart;
A:=Int(t^2*exp(-11*t), t);
B:=IntegrationTools:-Parts(A, t^2);
IntegrationTools:-Parts(B, t);
value(%);
diff(%, t);  # Check

                     

 

The problem is easily solved by simply enumerating all the options. We get 4 solutions with a minimum distance of 20 :

restart;
pts:=[[0, 0], [1, 1], [2, 5], [4, 2], [5, 3]]:
local D:
A,B,C,D,E:=pts[]:
dist:=(X,Y)->abs(X[1]-Y[1])+abs(X[2]-Y[2]):
P:=combinat:-permute([B,C,D,E]):
k:=0:
for p in P do
k:=k+1; d:=dist(A,p[1])+dist(p[1],p[2])+dist(p[2],p[3])+dist(p[3],p[4])+
dist(p[4],A); L[k]:=[p,d];
od:
L:=sort(convert(L,list),key=(x->x[2])):
L[1..4][];

   L := [[[[1, 1], [2, 5], [5, 3], [4, 2]], 20], [[[1, 1], [4, 2], [5, 3], [2, 5]], 20], [[[2, 5], [5, 3], [4, 2], [1, 1]], 20], [[[4, 2], [5, 3], [2, 5], [1, 1]], 20], [[[1, 1], [2, 5], [4, 2], [5, 3]], 22], [[[1, 1], [5, 3], [4, 2], [2, 5]], 22], [[[2, 5], [4, 2], [5, 3], [1, 1]], 22], [[[5, 3], [4, 2], [2, 5], [1, 1]], 22], [[[1, 1], [4, 2], [2, 5], [5, 3]], 24], [[[1, 1], [5, 3], [2, 5], [4, 2]], 24], [[[4, 2], [2, 5], [5, 3], [1, 1]], 24], [[[5, 3], [2, 5], [4, 2], [1, 1]], 24], [[[2, 5], [1, 1], [4, 2], [5, 3]], 26], [[[2, 5], [1, 1], [5, 3], [4, 2]], 26], [[[4, 2], [5, 3], [1, 1], [2, 5]], 26], [[[5, 3], [4, 2], [1, 1], [2, 5]], 26], [[[2, 5], [5, 3], [1, 1], [4, 2]], 28], [[[4, 2], [1, 1], [2, 5], [5, 3]], 28], [[[4, 2], [1, 1], [5, 3], [2, 5]], 28], [[[5, 3], [2, 5], [1, 1], [4, 2]], 28], [[[2, 5], [4, 2], [1, 1], [5, 3]], 30], [[[4, 2], [2, 5], [1, 1], [5, 3]], 30], [[[5, 3], [1, 1], [2, 5], [4, 2]], 30], [[[5, 3], [1, 1], [4, 2], [2, 5]], 30]]

     [[[1, 1], [2, 5], [5, 3], [4, 2]], 20], [[[1, 1], [4, 2], [5, 3], [2, 5]], 20], [[[2, 5], [5, 3], [4, 2], [1, 1]], 20], [[[4, 2], [5, 3], [2, 5], [1, 1]], 20]

The code below works. 10 frames are allocated for each n :

restart;
WM := n -> plots:-matrixplot(P^n, heights=histogram):
P := Matrix(2$2, [0.8, 0.2, 0.4, 0.6]);
plots:-animate(WM, [n], n=[seq(i$10,i=1..10)]);

                   

 

restart;
with(LinearAlgebra):
with(GraphTheory):
ts:=time():
g:=Graph(Matrix([[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0]]));

Eg := add(abs(Eigenvalues(AdjacencyMatrix(g)))):
evalf(%);

DEg := add(abs(Eigenvalues(AllPairsDistance(g)))):
evalf(%);

time()-ts;

 g := Graph 1: an undirected unweighted graph with 31 vertices  and 30 edge(s)
                          37.91134763
                          614.5329657
                             0.922
 

Use the  combinat:-choose  command.

Example:

L:={P1,P2,P3,P4,P5}:
L1:=combinat:-choose(L, 3);
map(mul, L1);

   

L1 := {{P1, P2, P3}, {P1, P2, P4}, {P1, P2, P5}, {P1, P3, P4}, 

  {P1, P3, P5}, {P1, P4, P5}, {P2, P3, P4}, {P2, P3, P5}, 

  {P2, P4, P5}, {P3, P4, P5}}

 {P1 P2 P3, P1 P2 P4, P1 P2 P5, P1 P3 P4, P1 P3 P5, P1 P4 P5, 

   P2 P3 P4, P2 P3 P5, P2 P4 P5, P3 P4 P5}
 

 

 

Use the  tickmarks  option for this.

An example:

restart;
f:=(x,y)->x^2+y^2:
interface(rtablesize=11):
M:=Matrix([seq([seq(f(x,y),x=0..5,0.5)],y=0..5,0.5)]);
plots:-matrixplot(M, heights = histogram, colorscheme = ["Blue", "Green", "Yellow", "Red"], axes=normal, tickmarks=[[seq(i=0.5*i-0.75,i=1.5..11.5,1)],[seq(i=0.5*i-0.75,i=1.5..11.5,1)],default], labels=[x,y,"f(x,y)"], orientation=[-75,75]);

                            

Looks like a bug. Below is a workaround:

plots:-display(
	plots:-implicitplot(`if`(y<=1-x^2,-x^2+y,undefined), x = 0 .. 2, y = -2 .. 1, color=red),
	plot(1-x^2, x=0..2, color=blue), scaling=constrained, view=[0..2,-2..1]
);

                                    

 

In fact, your expression is a first degree polynomial with respect to  exp(x) . Its coefficients should be simplified but not factored:

restart;
expr:= (cos(x)^2+sin(x)^2)+5+(1+x+x^2+x^3)*(cos(x)^2+sin(x)^2)*exp(x);
simplify~([coeffs(expr,exp(x),'t')]);
add(%*~t);

                         

Another reliable way to find all complex roots (in particular, real roots) of some analytic function in the specified intervals is to use RootFinding:-Analytic command:

restart:
line := x/100 - 1/2:
wave := cos(x/5) * sin(x/2): ## -1 <= wave <= 1
eq:= line - wave:
L:=sort([RootFinding:-Analytic(eq, re=-50..150, im=-1..1)]);
nops(L);
plot(eq, x=-50..150, -0.05..0.05, color=red, size=[1000,400]);

              

 

The line

((max-min)/abs(Mean))(S);

is incorrect. Should be

(max-min)(S)/abs(Mean(S)); 


The result is the same as 

((max-min)/(abs@Mean))(S);

 

First 29 30 31 32 33 34 35 Last Page 31 of 289