Kitonum

21680 Reputation

26 Badges

17 years, 185 days

MaplePrimes Activity


These are replies submitted by Kitonum

@Bendesarts   Do all things similarly, only replace  eq  by  lhs(eq_liaison[1, 1])  and etc.

@Carl Love  Visually  f[`3x`,`4y`]  is identical to  f[`3x, 4y`]

@yihezhi 

f[`{6x}`]; f[`{3x,4y}`];

 

 

@Bendesarts  For some reason your last file is not downloaded. In my M 16 all works. See the attached file.

Solving_equation.mw

Here is the copy of the code:

eq := 2*sin(alpha(t))*sin(beta(t))*cos(a[1])*sin(a[1])*cos(gamma[1](t))*e[1]*rBTP[1]- 2*cos(alpha(t))*cos(beta(t))*h*h[1]+2*sin(beta(t))*sin(a[1])*h*rF[1]- 2*cos(alpha(t))*cos(a[1])^2*rBTP[1]*rF[1]-2*z(t)*sin(alpha(t))*cos(a[1])*rBTP[1]+ 2*z(t)*cos(alpha(t))*cos(beta(t))*h+2*sin(alpha(t))*cos(a[1])*h[1]*rBTP[1]+ 2*cos(beta(t))*cos(gamma[1](t))*e[1]*rBTP[1]+2*cos(beta(t))*cos(a[1])^2*rBTP[1]*rF[1]+ 2*sin(gamma[1](t))*e[1]*h[1]-2*z(t)*sin(gamma[1](t))*e[1]-2*cos(gamma[1](t))*e[1]*rF[1]- 2*cos(beta(t))*rBTP[1]*rF[1]-2*z(t)*h[1]-l[1]^2+ 2*sin(alpha(t))*cos(beta(t))*cos(a[1])*cos(gamma[1](t))*h*e[1]- 2*cos(alpha(t))*sin(beta(t))*sin(a[1])*sin(gamma[1](t))*e[1]*rBTP[1]- 2*sin(alpha(t))*sin(beta(t))*cos(a[1])*sin(a[1])*rBTP[1]*rF[1]+z(t)^2+ h[1]^2+rBTP[1]^2+e[1]^2+rF[1]^2+h^2+2*cos(alpha(t))*cos(a[1])^2* cos(gamma[1](t))*e[1]*rBTP[1]-2*cos(alpha(t))*sin(beta(t))*sin(a[1])*h[1]*rBTP[1]- 2*cos(alpha(t))*cos(beta(t))*sin(gamma[1](t))*h*e[1]-2*sin(beta(t))*sin(a[1])* cos(gamma[1](t))*h*e[1]-2*cos(beta(t))*cos(a[1])^2*cos(gamma[1](t))*e[1]*rBTP[1]+ 2*z(t)*cos(alpha(t))*sin(beta(t))*sin(a[1])*rBTP[1]-2*sin(alpha(t))*cos(beta(t))* cos(a[1])*h*rF[1]+2*sin(alpha(t))*cos(a[1])*sin(gamma[1](t))*e[1]*rBTP[1];

eq1 := collect(subs(sin(gamma[1](t)) = x, cos(gamma[1](t)) = y, eq), [x, y]);

A := coeff(eq1, x);

B := coeff(eq1, y);

C := tcoeff(eq1, [x, y]);

sol := solve(a*sin(t)+b*cos(t)+c, t);

gamma1 := unapply(eval(sol[1], {a = A, b = B, c = C}), t);

gamma2 := unapply(eval(sol[2], {a = A, b = B, c = C}), t);

 

diff(f(x,y),x$6);


diff(f(x,y),[x$3],[y$4]);

 

 

@ctnaz   No, the numbers  2  and  0.94  I got just by selection, banishing my program several times for different values​​.

@Preben Alsholm  Thanks for the solution! I've tried similar variants, but my mistake was that I took too little eps=10^(-6)

@Kitonum  

My first program was unsuccessful. I forgot that break keyword only interrupts the inner loop, but the program continues to run. Therefore returned not the first but the last solution.
One solution (the first one) can be found immediately when the program as a procedure to issue and uses  return keyword:

restart;
P := proc ()
local a, b, c, d, e, f, g, h;
for c from -10 to 10 do
for d from -10 to 10 do
for e from -10 to 10 do
for f from -10 to 10 do
for g from -10 to 10 do
for h from -10 to 10 do
a := c+2*d+4*e+6*f+10*g+22*h-16; b := -2*c-3*d-5*e-7*f-11*g-23*h+20;
if -10 <= a and a <= 10 and -10 <= b and b <= 10 then return [a, b, c, d, e, f, g, h]
end if end do end do end do end do end do end do
end proc:

P();

                                               [10, 10, -10, -10, -10, 8, 7, -1]

@Mikhail Drugov  Yes,  I think there is no automatic way.

@brian bovril  Of course I can. This is really easy.

Let the member of the sequence, standing on the  n-th position is  m. Then it is obvious that

1+2+...+(m-1)< n <=1+2+...+m   or   (m-1)*m/2< n <=m*(m+1)/2

Then, solving this double inequality for m> = 1, we obtain

-(1/2) + 1/2*sqrt(1 + 8*n) <= m < 1/2 + 1/2*sqrt(1 + 8*n)

 

Because left and right parts of the solution differ by 1, we immediately obtain the formula.

The question arises - what of it relates to Maple?

your question more specifically?

@Carl Love   

I think that the use of functions  ln  and  evalf  is impractical,  because it slows down the calculation. As discrepancy for a given partition I take the simple sum of absolute differences.

Compare two approaches for the small set {$ 1 .. 15}:

restart;

ts := time():

S := {$ 1 .. 15}:
AllP := [seq(P, P = Iterator:-SetPartitions(S, [[5, 3]], compile = false))]:
lnp := evalf(ln((`*`(S[]))^(1/3))):
Var := proc (P::(list(set)))
local r; r := evalf(`+`(map(proc (b) options operator, arrow; abs(ln(`*`(b[]))-lnp) end proc, P)[])) end proc: 
sort(AllP, (x, y) ->Var(x) < Var(y) )[1];

time()-ts;

                       [{1, 8, 9, 10, 15}, {2, 5, 7, 12, 13}, {3, 4, 6, 11, 14}]
                                                             322.328

 

restart;

ts := time():

S := {$ 1 .. 15}: Var := infinity:

T := combinat[choose](S, 5):

for t in T do

S1 := `minus`(S, t):

U := combinat[choose](S1, 5):

for u in U do

S2 := `minus`(S1, u):

Var1 := abs(convert(t, `*`)-convert(u, `*`))+abs(convert(u, `*`)-convert(S2, `*`))+abs(convert(t, `*`)-convert(S2, `*`)):

if Var1 < Var then Var := Var1:

L := {Var, {S2, t, u}} end if

end do end do:

L;

time()-ts;

                                {576, {{1, 4, 13, 14, 15}, {2, 5, 9, 10, 12}, {3, 6, 7, 8, 11}}}
                                                                                 14.516

 

The results are different, but the discrepancy is actually one and the same, that just shows the non-uniqueness of solution:

[{1, 8, 9, 10, 15}, {2, 5, 7, 12, 13}, {3, 4, 6, 11, 14}];

abs(convert(%[1], `*`)-convert(%[2], `*`))+abs(convert(%[2], `*`)-convert(%[3], `*`))+abs(convert(%[3], `*`)-convert(%[1], `*`));

                                                                576

@Markiyan Hirnyk  In my example, do the rotation by the angle  arcsin (a/2)  about the axis Oy and the homothety with coefficient  sqrt (3) and the center at the origin. Then you will get the same coordinates as in Wiki.

@Markiyan Hirnyk 

1. Both procedures are very simple conceptually and based on brute force technique of two or three vertices and then checking (using geometric properties listed above). So I do not think there is a need for separate comments.

2. To be more precise, that used O (n ^ 3) algorithm, because  binomial(n, 3)=n*(n-1)*(n-2)/6 . Of course, in terms of time, these procedures are not optimal and appropriate for relatively small polygons (n<100). But their advantages in simplicity and exact solutions. Therefore they can be used in the proofs in geometry problems.

3. I do not agree with this statement "Exact solutions and close-form-expressions are from somewhat outdated math" . The advantage of an exact solution at least in the fact that from it is easy to get  an approximate solution with any precision, but not vice versa.

 

First 112 113 114 115 116 117 118 Last Page 114 of 133