## 14289 Reputation

11 years, 228 days

## Error...

Dear Mr. Hirnik! Unfortunately, the calculations made ​​by you in the package DirectSearch are wrong! Look at the screenshot and all become clear. First, using the procedure P1 i found true minimum for the first 10 numbers from your list, then for next 15. From the inequality |a+b|<=|a|+|b| obtained a rough estimate of initial minimum. I think that actually it is even much less!

## Correction...

Your code does not work because:

1) For the command DotProduct the option conjugate=false is required.

2) The system has not one but two solutions.

The corrected code:

restart:

with(LinearAlgebra):

A:=<-1,3,6>: B:=<2,2,-0>: N:=<x,y,z>: o:=<1,-1,7>:

Sys:={Norm(o-N,2)^2=9, DotProduct(N - o, N-A,conjugate=false) = 0, DotProduct(N - o, N-B,conjugate=false) = 0}:

Sol:=[solve(Sys)]:

N1:=[seq(rhs(Sol[1,i]),i=1..3)];

N2:=[seq(rhs(Sol[2,i]),i=1..3)];

## Correction...

Your code does not work because:

1) For the command DotProduct the option conjugate=false is required.

2) The system has not one but two solutions.

The corrected code:

restart:

with(LinearAlgebra):

A:=<-1,3,6>: B:=<2,2,-0>: N:=<x,y,z>: o:=<1,-1,7>:

Sys:={Norm(o-N,2)^2=9, DotProduct(N - o, N-A,conjugate=false) = 0, DotProduct(N - o, N-B,conjugate=false) = 0}:

Sol:=[solve(Sys)]:

N1:=[seq(rhs(Sol[1,i]),i=1..3)];

N2:=[seq(rhs(Sol[2,i]),i=1..3)];

## It's impossible...

Your function depends on 4 variables. To plot only if the number of variables does not exceed 2.

## The corrected code...

Here is the corrected code:

A:=<0,1,2>:  M:=<2*t,1 + t,-1 - t>: N:=<1+m, -1 -2*m,2+m>:

u:=A - M: v:=A - N:

w:=LinearAlgebra[CrossProduct](u,v):

solve([seq(w[i]=0,i=1..3)]): assign(%):

'M'=M; 'N'=N;

## The corrected code...

Here is the corrected code:

A:=<0,1,2>:  M:=<2*t,1 + t,-1 - t>: N:=<1+m, -1 -2*m,2+m>:

u:=A - M: v:=A - N:

w:=LinearAlgebra[CrossProduct](u,v):

solve([seq(w[i]=0,i=1..3)]): assign(%):

'M'=M; 'N'=N;

## Incorrect argument...

Why do you think that the parameters of two different lines for the same point must be the same? Take t =- 1 / 3 for the first line, and t = 2 / 3 for the second straight. Get the same point!

## Incorrect argument...

Why do you think that the parameters of two different lines for the same point must be the same? Take t =- 1 / 3 for the first line, and t = 2 / 3 for the second straight. Get the same point!

If k is not 0 and not 1, then your problem will have two solutions. For example, for your example the second solution would be if you take k =- 2 in your formulas .

If k is not 0 and not 1, then your problem will have two solutions. For example, for your example the second solution would be if you take k =- 2 in your formulas .

## Incorrect example...

Dear Mr. Hirnyk! The procedure is written for any skew lines and your lines intersect at the point [-1, -1 / 3, 2 / 3].

Of course, checking of the lines may be included in the text of the procedure, but it does not matter!

## Incorrect example...

Dear Mr. Hirnyk! The procedure is written for any skew lines and your lines intersect at the point [-1, -1 / 3, 2 / 3].

Of course, checking of the lines may be included in the text of the procedure, but it does not matter!

## Explanation...

If three points A, B and C are collinear, they define a single plane, and each point M of this plane is given by the formula M = xA + yB + zC, where x + y + z = 1. The numbers x, y, z are called the barycentric coordinates of the point M.

## Explanation...

If three points A, B and C are collinear, they define a single plane, and each point M of this plane is given by the formula M = xA + yB + zC, where x + y + z = 1. The numbers x, y, z are called the barycentric coordinates of the point M.