Discussion:
A simple Solve gives me errors
(too old to reply)
Ste[hen Gray
2014-04-23 08:53:54 UTC
Permalink
I want to find the center C of a circle in 3D where the plane is defined
by points p1,p2,p3. I wrote this:

p1 = {p1x, p1y, p1z}; (* tell it that p1,p2,p3 are vectors *)
p2 = {p2x, p2y, p2z}; (* center of circle ctr = f p1+g p2+(1-f-g)p3 *)
p3 = {p3x, p3y, p3z}; (* keep the center in the plane of p1,p2,p3 *)

ctr = f p1 + g p2 + (1 - f - g) p3;
eq1 = (ctr - p1).(ctr - p1) - (ctr - p2).(ctr - p2) := 0;
eq2 = (ctr - p1).(ctr - p1) - (ctr - p3).(ctr - p3) := 0;

I get errors of a type I've seen before:

SetDelayed::write: Tag Norm in Norm[{-p1x+f p1x+g p2x+(1-f-g) p3x,-p1y+f
p1y+g p2y+(1-f-g) p3y,-p1z+f p1z+g p2z+(1-f-g) p3z}] is Protected. >>

And a similar one. I don't know what to do about this.
I want to do
Solve[{eq1, eq2}, {f, g}]
Murray Eisenberg
2014-04-24 08:02:56 UTC
Permalink
In the definitions of eq1 and eq2, ":=", which means SetDelayed, should be "==" (double equals sign), which means Equal and is used to form equations.
Post by Ste[hen Gray
I want to find the center C of a circle in 3D where the plane is defined
p1 = {p1x, p1y, p1z}; (* tell it that p1,p2,p3 are vectors *)
p2 = {p2x, p2y, p2z}; (* center of circle ctr = f p1+g =
p2+(1-f-g)p3 *)
Post by Ste[hen Gray
p3 = {p3x, p3y, p3z}; (* keep the center in the plane of p1,p2,p3 *)
ctr = f p1 + g p2 + (1 - f - g) p3;
eq1 = (ctr - p1).(ctr - p1) - (ctr - p2).(ctr - p2) := 0;
eq2 = (ctr - p1).(ctr - p1) - (ctr - p3).(ctr - p3) := 0;
SetDelayed::write: Tag Norm in Norm[{-p1x+f p1x+g p2x+(1-f-g) p3x,-p1y+f
p1y+g p2y+(1-f-g) p3y,-p1z+f p1z+g p2z+(1-f-g) p3z}] is Protected. >>
And a similar one. I don't know what to do about this.
I want to do
Solve[{eq1, eq2}, {f, g}]
Murray Eisenberg ***@math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 240 246-7240 (H)
University of Massachusetts
710 North Pleasant Street
Amherst, MA 01003-9305
Bill Rowe
2014-04-24 08:03:16 UTC
Permalink
Post by Ste[hen Gray
I want to find the center C of a circle in 3D where the plane is
eq1 = (ctr - p1).(ctr - p1) - (ctr - p2).(ctr - p2) := 0;
eq2 = (ctr - p1).(ctr - p1) - (ctr - p3).(ctr - p3) := 0;
You cannot use SetDelayed (:=) in place of Equal (==). You get
the error since SetDelayed is attempting to do precisely what it
is documented to do. That is assign the value 0 to expression on
the left hand side. This clearly isn't what you want and isn't
something Mathematica can do.

Rewrite your definitions for eq1 and eq2 replacing := with ==
and you should get the result you want.
Alexei Boulbitch
2014-04-24 08:03:37 UTC
Permalink
I want to find the center C of a circle in 3D where the plane is defined
by points p1,p2,p3. I wrote this:

p1 = {p1x, p1y, p1z}; (* tell it that p1,p2,p3 are vectors *)
p2 = {p2x, p2y, p2z}; (* center of circle ctr = f p1+g p2+(1-f-g)p3 *)
p3 = {p3x, p3y, p3z}; (* keep the center in the plane of p1,p2,p3 *)

ctr = f p1 + g p2 + (1 - f - g) p3;
eq1 = (ctr - p1).(ctr - p1) - (ctr - p2).(ctr - p2) := 0;
eq2 = (ctr - p1).(ctr - p1) - (ctr - p3).(ctr - p3) := 0;

I get errors of a type I've seen before:

SetDelayed::write: Tag Norm in Norm[{-p1x+f p1x+g p2x+(1-f-g) p3x,-p1y+f
p1y+g p2y+(1-f-g) p3y,-p1z+f p1z+g p2z+(1-f-g) p3z}] is Protected. >>

And a similar one. I don't know what to do about this.
I want to do
Solve[{eq1, eq2}, {f, g}]

Hi,

It is just == instead of := and everything works. Try this:

p1 = {p1x, p1y, p1z}; (*tell it that p1,p2,p3 are vectors*)
p2 = {p2x, p2y, p2z}; (*center of circle ctr=f p1+g p2+(1-f-g)p3*)
p3 = {p3x, p3y, p3z}; (*keep the center in the plane of p1,p2,p3*)
ctr =f p1 + g p2 + (1 - f - g) p3;
eq1 = (ctr - p1).(ctr - p1) - (ctr - p2).(ctr - p2) == 0;
eq2 = (ctr - p1).(ctr - p1) - (ctr - p3).(ctr - p3) == 0;

Solve[{eq1, eq2}, {f, g}]

But the returned result is very long.

Nave fun, Alexei



Alexei BOULBITCH, Dr., habil.
IEE S.A.
ZAE Weiergewan,
11, rue Edmond Reuter,
L-5326 Contern, LUXEMBOURG

Office phone : +352-2454-2566
Office fax: +352-2454-3566
mobile phone: +49 151 52 40 66 44

e-mail: ***@iee.lu

Loading...