20354 Reputation

26 Badges

16 years, 11 days

MaplePrimes Activity

These are answers submitted by Kitonum

The example:

15 mod(4);


None sequence is  uniquely determined by several members without additional conditions! If we look for a formula in a class of polynomials of degree <=5, then the decision will be

a[n]=CurveFitting[PolynomialInterpolation]([1, 2, 3, 4, 5, 6],[1, 3, 6, 12, 33, 51],n);

I got the same answer. In my decision  and  t  are the parameter values ​​for those points on the lines, for which is realized a distance equal to 1.

The code of my decision:


A:=<1, -1, 3>:   u:=<a, b, c>:   v:=<2, -5, 6>:   M:=A+s*u:   N:=t*v:

solve([a^2+b^2+c^2=1, DotProduct(<1, 1, 5>,u,conjugate = false)=0, DotProduct(M-N,u,conjugate = false)=0, DotProduct(M-N,v,conjugate = false)=0, Norm(M-N,2)=1],[a,b,c,s,t]);

If you subtract the first equation of the second equation, it is easy to find  z = 3/2 , ie all points of the curve lie in the horizontal plane  z = 3/2 . Substituting  z = 3/2  in any equation, we obtain the equation of a circle. The parametric equation of this circle will be  x=3*sqrt(3)/2*cos(t), x=3*sqrt(3)/2*sin(t), z=3/2 .

Code for the construction of the curve and surfaces:

A:=plots[spacecurve]([3*sqrt(3)/2*cos(t),3*sqrt(3)/2*sin(t), 3/2],t=0..2*Pi,color=red,axes=normal,thickness=3):

B:=plots[implicitplot3d]({x^2+y^2+z^2 = 9, x^2+y^2+(z-3)^2 = 9}, x = -5 .. 5, y = -5 .. 5, z = -3.5 .. 6.5, numpoints = 27000, style = surface):


There is a serious mistake in your decision! Why do you define the line l in such a strange way, taking on it arbitrarily point C? This line is already defined by its equation! And if you specify another point  C, you would get a different line.  

I would write your code like this:

restart: with(geometry):





sys:=solve([distance(T,A) = distance(T,B), distance(T,A)=distance(T,l)],[a,b]):

point(o, rhs(sys[1,1]), rhs(sys[1,2])):

point(K, rhs(sys[2,1]), rhs(sys[2,2])):

sort(Equation(circle(c1,[o,distance(o,A)],[x,y]))); # First solution

sort(Equation(circle(c2,[K,distance(K,A)],[x,y]))); # Second solution


Unfortunately, I haven't found a way for keeping such a format. So everything had to be done by hand. If you need this often, you can write the procedure.

See an example:

plot(exp(-x), x = 0 .. 10, axis[2] = [mode = log], tickmarks = [default, [seq(10^(-i) = 10^convert(-i, symbol), i = 0 .. 4, .5)]])







Since none of the numbers 5, 10, 20, 50 does not have a factor 3, then i think it's  impossible to express the log [9] (40) as rational function  of c and d.

f(alpha):=1+2*cos(alpha): # as assigning an expression

plot(f(alpha), alpha=-2*Pi/3..2*Pi/3, coords=polar);  # or


f:=alpha->1+2*cos(alpha): # as assigning a function

plot(f, -2*Pi/3..2*Pi/3, coords=polar);  # or

plot(f(t), t=-2*Pi/3..2*Pi/3, coords=polar);

Second way more universal! We see that the argument of a function can be no specify or denoted by other names.

Dear Mr. Hirnik! Thank you very much for the detailed comment and the time spent! Unfortunately, your code for the solution of this example as an integer linear programming problem has an error. Look at the example and all will be clear:

But if the error would be corrected , the package still does not solve this problem! Look what I got:

The problem was solved after i fundamentally rewrote my previous procedure P1. The basic idea: now I do not form immediately the whole list of possible arrangements of {-1, 1}. For your list of 25 of the eleven-digit numbers, this list will have 2^25  elements, and it's more 32 million. So my previous procedures P and P1 did not work, because in Maple, apparently, there is a limit on the length of the generated lists. Now at first I build two much shorter lists, and then concatenate them in a loop, and  by bubble's method i find the minimum, and the appropriate placement of signs.

The code of the new procedure:


local It,n1, n2,M0, M1, M2, Min, i, j, S,T ;



end proc;

n1:=floor(nops(L)/2); n2:=ceil(nops(L)/2)-1;

M1:=(It@@n1)([[ ]]); M0:=(It@@n2)([[ ]]); M2:=[seq([1,op(M0[i])],i=1..nops(M0))]; 


for i from 1 to nops(M1) do

for j from 1 to nops(M2) do


if S<Min then Min:=S; T:=[seq(L[k]*M1[i,k],k=1..n1),seq(L[n1+k]*M2[j,k],k=1..n2+1)];


od; od;



end proc:

Solving of the problem:

st:= time():  P2([42924197338, 42184753307, 4832623176, 84884659951, 6402031177, 88749509929,  26310525700, 48147481357, 77529384202, 60286056128, 36115225338,

 49211688701, 45043765556, 98444407624, 37828057713, 42961778036,  97541730413, 32830562321, 23433482548, 72043425495, 6759224825, 89664990345,  37830825668, 77385749629, 25000320804]); 

cat(convert(time() - st,symbol),`  seconds`)=cat(convert(evalf[4]((time() - st)/60),symbol),`  minutes`);

You have two solutions. I would have written this line without "op" by way:

for i from 1 to 2 do `M`[i]:=subs(sol[i],[0,a,0]) end do;



Dear Anton!  There is a standard way of saving the results obtained at each step of the loop of your procedure. Before the loop you create an empty list, and then at each step of the loop adding to this list the results according the scheme:  

1) Before the loop  L:=[ ]:

2) In the loop  L:= [ [х(t[i]), y(t[i]), ... ], op(L) ] , where  х(t[i]), y(t[i]), ...  are the results obtained on i_th step of the work of your loop.

If you speak Russian, you can ask your questions on the forum

combine(sqrt(a+sqrt(b))*sqrt(a-sqrt(b))-sqrt((a+sqrt(b))*(a-sqrt(b)))) assuming a>0,b>0,a>sqrt(b);


This is called a parametric form of the equation of the line. Read  ?plot/details 

plot([1, 2-x, [0.466667, t, t=-2..1.5]], x=0..3, -2..2);


B:= [3,4]:

C:= [op(A), op(B)];

First 277 278 279 280 281 282 Page 279 of 282