Message Boards Message Boards

0
|
7043 Views
|
6 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Possible bug or I am blind about something??

Posted 11 years ago
Just wanted to plot a circle to solve an analytic geometry problem:  The equation of the circle is (x-2)^2 + (y+1)^2 == 6^2  I had mathematica solve for y so I could plot both sides of the circle.  
Solve[(x-2)^2+(y+1)^2==6^2,y]
Mathematica returned the following results:
{{y->-1-Sqrt[-4+4 x-x^2+36 ^2]},{y->-1+Sqrt[-4+4 x-x^2+36 ^2]}}
When the circle was plotted, the circle had a radius around 38 instead of 6 as indicated in the standard form of a circle.

What am I missing here???
POSTED BY: Raymond Low
6 Replies
I get this, what do you see?
Plot[y /.  Solve[ (x - 2)^2 + (y + 1) ^2 == 6^2, y], {x, -10, 10},
AspectRatio -> 1, PlotRange -> {{-10, 10}, {-10, 10}}]
POSTED BY: C ormullion
Are you sure that the results you quote were returned by this Solve command?

Mathematica cannot have returned these solutions because they are not fully evaluated.  Note the 36^2 - 4 part.  Mathematica would always print 1292.

The actual solution returned by version 9.0.1 is correct.
POSTED BY: Szabolcs Horvát
There might have been a non-printing character that slipped into the input before the 6^2.
The corresponding output has  36 space ^2, which is suspicious.

You can select the cell bracket and go to Cell menu - Cell Expression.   The problem might be apparent.

Usual fixes are
- re-type that section of the input, or the whole input, and
- select the input, use Edit menu - CopyAs - Plain Text, and paste it into a different place in the notebook.
POSTED BY: Bruce Miller
Posted 11 years ago
Clear["Gobal`*"]
Solve[(x - 2)^2 + (y + 1)^2 == 6^2  , y]
Solve[(x - 2)^2 + (y + 1)^2 == 6^2, y]
Plot[{-1 - Sqrt[-4 + 4 x - x^2 + 36^2], -1 +
   Sqrt[-4 + 4 x - x^2 + 36^2]}, {x, -40, 40}]
Plot[{-1 - Sqrt[32 + 4 x - x^2], -1 + Sqrt[32 + 4 x - x^2]}, {x, -10,
  10}]
{{y->-1-Sqrt[-4+4 x-x^2+36 ^2]},{y->-1+Sqrt[-4+4 x-x^2+36 ^2]}}
{{y->-1-Sqrt[32+4 x-x^2]},{y->-1+Sqrt[32+4 x-x^2]}}

Thanks Bruce - seems you were right.  I retyped that equation and got the right results.  it seems what I thought were just spaces, were something else.  What can I do to tell what non-printing characters slipped in??   again, thanks all for your help...
POSTED BY: Raymond Low
Posted 11 years ago
Thankfully rare stumbling block in Mathematica: you can insert invisible operators in equations. I think I managed to find a shortcut for invisible addition (or something similar) once, and scratched my head for half and hour trying to understand what made my results so strange.
POSTED BY: Jari Kirma
"What can I do to tell what non-printing characters slipped in?? "

May be this can help how-to-find-pieces-of-code-responsible-for-syntax-errors

It is about hidden chars that can slip in sometimes into the notebook cell.
POSTED BY: Nasser M. Abbasi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract