Message Boards Message Boards


Error "unable to solve" using NSolve on circle-equation

Posted 1 year ago
3 Replies
2 Total Likes

I would like to solve a circle equation. I use Mathematica with Raspberry.
1.) I defined variables

c=-90, d=27, r=10 , x=33,6777  

2.) I wrote:

NSolve[(x - c) ² + (y - d)² == r² , {y}, Reals]  

3.) I'm interested in y
4.) as a result I received
NSolve::ratnz: NSolve was unable to solve the system with inexact coefficients. The answer was obtained by solving a corresponding exact system and numericizing the result. {{y -> (0.0001 (-966777. .b2 + 10000. r.b2))/.b2}}
5.) I expected for y=-82,556

Can anybody help me.

POSTED BY: Rolf Kopsch
3 Replies

You seem to be asking "If I have a circle with radius 10 centered at {-90, 27} what is its height at x=33.677. Put like that it should be pretty obvious that there will be no solution except for -100<x<80. Also having b2 in the answer suggests your code does not do say what you say it says. b2 is coming from somewhere. I suggest you post the code in its entirety.

POSTED BY: Jon McLoone
Posted 1 year ago

Hi Jon,. thank you for your answer. I found my mistake. The main problem was "²" is complitely different from "^2". Now my Problem is solved. But maybe you have an Idea how i can raise the decimal places of the x and y values. and can I calculate with these values (x or y)?

POSTED BY: Rolf Kopsch

NSolve takes an option WorkingPrecision which lets you specify the number of decimal places to work to. It may also make sense to control the input precision of the real number with, say, 33.677`50 to pad it to 50 decimal places.

POSTED BY: Jon McLoone
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract