Kitonum

13489 Reputation

24 Badges

11 years, 101 days

MaplePrimes Activity


These are replies submitted by Kitonum

Thank you all! I did not expect the solution to be so simple.

@Teep 

restart;
X := [3, 6, 4, 13]:   Y := [8, 6, 5, 7]:  n:=nops(X):
local D;  
L:=[seq(seq([[[X[i],Y[i]],[X[j],Y[j]]],(i,j)=sqrt((X[i]-X[j])^2+(Y[i]-Y[j])^2)], j=i+1..n), i=1..n-1)];
T:=Matrix(4, {map(t->t[2],L)[],map(t->(lhs(t[2])[2],lhs(t[2])[1])=rhs(t[2]),L)[]}):
MatrixOfDistances:=<<``|A|B|C|D>,<<A,B,C,D>|T>>;

 

@Carl Love  Thank you for your interest. Unfortunately, getting a noticeable gain in time at the cost of obtaining only one solution is impossible. In the branch and bound method  each variant may branch out into several variants, or it may disappear altogether, if it cannot be continued. And this we will not know until we reach the last step. How the method works is clearly seen in the example below (the second example from the worksheet). I brought all the steps to the display:

    

 

@DimaBrt  I did not understand your comment. For me, everything works in Maple 2018.2.

@kambiz1199  You can use the  trace  option to show the intermediate positions of a ladder. See my updated answer above.

@Rouben Rostamian   I also do not know a short way. Here is a rather cumbersome way:

test := -2+exp(theta)+exp(-theta);
convert(test,trigh);
convert(%, tanh);
convert(%,exp);
factor(%);
numer(%)/simplify(denom(%));

 

@minhthien2016  Of course, this line is only needed to make these assignments  a:=...  and  b:=...  clear.

@acer  and  Carl. Thanks for replies! The trouble removed. 

I tried to test this procedure. I just copied the text of the procedure into a new worksheet. But during initialization, the error occurs:  Error, unexpected neutral operator

Can anyone confirm this situation? What could be the reason? I'm using Maple 2018.2

Error.mw

@hamideh 

restart;
plots:-implicitplot3d((x,y,z)->`if`(x<y and y<z,x^3*y*z-0.5,NULL), 0..5, 0..5, 0..5, style=surface, color=green, numpoints=500000, axes=normal, orientation=[55,75]);

                    

@Al86  The idea of how to find these values is suggested by the graph of the implicit function 

(x-2)^2*(x-3)+epsilon^2=0

(see the code above). The straight line  epsilon=C  (is a constant)  should cross this graph at exactly 2 points. One value is obvious  epsilon=0, and 2 others are easily found using the derivative:

epsilon1:=x->sqrt(-(x-2)^2*(x-3));
epsilon2:=x->-sqrt(-(x-2)^2*(x-3));
x1:=solve(D(epsilon1)(x)=0);
x2:=solve(D(epsilon2)(x)=0);
epsilon1(x1);
epsilon2(x2);

 

@David Sycamore

 

restart;
AlmostCarmichaelNumbers1:=proc(n::posint)
local L;
L:=ifactors(n);
if nops(L[2])>2 and L[2,1,1]<>2 and `and`(map(t->is(t[2]=1),L[2])[]) and irem(n-1,L[2,1,1]-1)=0 and irem(n-1,L[2,-1,1]-1)=0 and `and`(seq(irem(n-1,t[1]-1)<>0,t=L[2][2..-2])) then true else false fi;
end proc:


Example of use:

 select(AlmostCarmichaelNumbers1, [seq(i, i=1..20000, 2)]);
 
 [231, 1045, 1653, 4371, 4641, 5365, 6545, 8029, 9361, 10011, 10857, 13685, 13695, 15753, 16269, 18361, 18565]

Edit.

I first learned about this command from this post. It is not clear to me why it is necessary for all occasions to look for the appropriate command in Maple, if we can just write the simplest procedure. Example:

restart;
Dist:=(X,Y)->sqrt(add((X-~Y)^~2)):
X:=<1,2,3>: Y:=<2,3,4>:
Dist(X,Y);

 

To answer the question, we need to see your particular calculation. So submit here your code (as text and not a picture) using a bold green up arrow in the MaplePrimes editor, or simply upload your worksheet here using the same method.

@David Sycamore This combination of commands 

`and`(map(t->is(t[2]=1),L[2])[])

 makes the check for "squarefree".

Here is another example of how the procedure works up to some N (I took N = 1000):

seq([n,Check(n)], n=1..1000);
     

   

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