## 14284 Reputation

11 years, 228 days

## Explanation and visualization...

In the figure, the red broken  AEC  is the above border of the first assembly, and the red broken  ABC  is the above border of the second one. The blue line  AC  is a straight line. Using the  geometry  package, we show that the area of the quadrangle  ABCE  is exactly  1 .

```restart:
with(plottools): with(plots): with(geometry):
P1:=polygon([[0,0],[8,0],[8,3]], color="Pink", style=surface):
P2:=polygon([[8,0],[8,1],[10,1],[10,2],[13,2],[13,0]], color=green, style=surface):
P3:=polygon([[8,1],[8,3],[13,3],[13,2],[10,2],[10,1]], color="Yellow", style=surface):
P4:=polygon([[8,3],[13,5],[13,3]], color="Green", style=surface):
L:=plottools:-line([0,0],[13,5], color=blue):
L1:=curve([[0,0],[8,3],[13,5]],color=red,thickness=2):
L2:=curve([[0,0],[5,2],[13,5]],color=red,thickness=2):
A:=[0,0]: B:=[5,2]: C:=[13,5]: E:=[8,3]:
T:=textplot([[A[],"A"],[B[],"B"],[C[],"C"],[E[],"E"]],font=[times,20],align={above,left}):
P:=pointplot([A,B,C,E], symbol=solidcircle, color=red, symbolsize=8):
display(L,L1,L2, P1,P2,P3,P4,T,P, scaling=constrained, size=[1100,450], axis[1] = [gridlines = [13,color=grey,thickness=0]], axis[2] = [gridlines = [5,color=grey,thickness=0]], transparency=0.5);
area(triangle(t1,[point(AA,A),point(BB,B),point(EE,E)]))+area(triangle(t2,[point(CC,C),point(BB,B),point(EE,E)]));

```

## Bug and workaround...

I agree that this is a serious bug. It seems that in the second case Maple first rounds each of the operands to 2 digits, and only then performs the calculation. Therefore, we get  1000-1000 = 0 .
Here is a workaround:
restart:
P1 := 1007:
P3 := 1014.1:
P3 - P1:
evalf(%, 2);

7.1

A useful conclusion: first you need to do all the calculations with maximum accuracy (preferably symbolically), and only at the end, round to the desired number of digits.

, instead of  x , there should be a constant. I took  x=b :

 (1)

## assign...

```restart;
pointset := [A, [0,0], B, [0,v_B], C, [u_C, v_C], DD, [x_DD, y_DD], OO, [x_OO, y_OO]];
for i from 1 to nops(pointset) by 2 do
assign(pointset[i],pointset[i+1]);
od:```

A, B, C, DD, OO;
[0, 0], [0, v_B], [u_C, v_C], [x_DD, y_DD], [x_OO, y_OO]

Take a look at what your code does:

```restart;
pointset := [A, [0,0], B, [0,v_B], C, [u_C, v_C], DD, [x_DD, y_DD], OO, [x_OO, y_OO]]:
for i from 1 to nops(pointset) by 2 do
pointset[i]:=pointset[i+1];
od:
A, B, C, DD, OO;
seq(pointset[i], i=[1,3,5,7,9]);
```

A, B, C, DD, OO
[0, 0], [0, v_B], [u_C, v_C], [x_DD, y_DD], [x_OO, y_OO]

The difference between  X:=Y and assign(X,Y)  is that in the first case  X  is not evaluated.
I replaced the names  D  and  O  with  DD  and  OO  because  D  and  O  are protected.

Of course, it’s most convenient to use a multiple assignment in your problem:

A, B, C, DD, OO :=   [0, 0], [0, v_B], [u_C, v_C], [x_DD, y_DD], [x_OO, y_OO];

```restart;
#FIRST STEP: Lets find the recursive formula for
d:=proc(m)
option remember;
if m=1 then return 1 else
end proc:
#lets check
for i from 1 to 4 do
d(i);
end do; ```

The code for the matrix:

```DD:=m->Matrix(m,m, (i,j)->`if`(i>j,0,d[j-i+1])):
DD(4);```

## solve...

Just solve these equations together by taking different names for the parameters. If the number of solutions is infinite, then the lines coincide. If Maple returns a unique solution, then the lines intersect. If Maple returns NULL (no solutions), then the lines are parallel:

```restart;
L1:=<2-4*t,5+6*t>: L2:=<-6-12*s,17+18*s>: L3:=<20*t,-30*t>:
solve({L1[1]=L2[1],L1[2]=L2[2]}); # The lines are identical
solve({L2[1]=L3[1],L2[2]=L3[2]}); # The lines are parallel
```

Output:                                   {s = s, t = 2+3*s}
NULL

Additionally, in the first example, a relationship is established between the parameters. In 3D, the solution is about the same. The straight lines will be skew if there are no solutions and the direction vectors (coefficients in front of the parameters) are not collinear. Writing a procedure for all of these is trivial.

## Solution...

You have a linear system with unknowns  [A,B,C,E,L,F], so you can solve it using  LinearAlgebra:-LinearSolve  command. Maple does not return the whole solution (due to its bulkiness), but you can get the values of individual unknowns (in the file  below the first unknown is returned):

Should be:

```for j to numelems(rkVals) do rk := rkVals[j];
p := fsolve({a[1], a[2]});
plts := plts, plot(eval(f, p), x = 0 .. 1, color = colors[j]);
plts := plts;
ta := eval(eval(diff(f, x\$2), p), x = 0);
print(ta);
end do:```

-2.277141067
-2.445405258
-2.630934764
-2.835347980

The  color  option should not be used with  plots:-display  command.

 > restart;
 > restart;
 > with(plots):
 > diff(y(x), x) = sqrt(y(x)^(-1-3*w)-k)
 (1)
 > w:=0;
 (2)
 > k:=-1;
 (3)
 > A:=dsolve({diff(y(x), x) = sqrt(y(x)^(-1-3*w)-k),y(0)=1},type=numeric,range=-1..10,output=listprocedure);
 (4)
 > k:=1;
 (5)
 > B:=dsolve({diff(y(x), x) = sqrt(y(x)^(-1-3*w)-k),y(0)=0.9999},type=numeric,range=-1..10,output=listprocedure);