Suppose you are designing a part of a program for a medical robot that has a sensor returning an x- and y-location (measured in cm). You need to check whether the sensor location is inside the circle, outside the circle, or on the boundary (specifically, having a distance of less than 1 mm from the boundary). Assume the circle has center (0, 0) and a radius of 2 cm. Give a set of test cases.
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
Big Java Late Objects
Additional Engineering Textbook Solutions
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Data Mining for Business Analytics: Concepts, Techniques, and Applications with XLMiner
Starting Out with C++ from Control Structures to Objects (9th Edition)
Starting Out with Programming Logic and Design (4th Edition)
Computer Systems: A Programmer's Perspective (3rd Edition)
Differential Equations: Computing and Modeling (5th Edition), Edwards, Penney & Calvis
- Consider you are standing at a street corner, in a city where the streets are laid out in a very regular grid pattern. At this point you randomly choose and intersection to turn on to (left, right, forward or backward - let’s say). You walk further to another intersection and make the same random choice. Rinse, lather, repeat. When you finally stop, your winding path is some direct distance away from your starting point. This is an example of a random walk. It’s a probabilistic simulation of certain statistical systems (like photons inside a star, or Brownian motion of molecules). In n steps, how far do you expect to be from your starting point? Write a Python program to help answer this question. The requirements for this assignment are straightforward: You will need to use function(s) from the Python random module. Your main function will be used to ask for user input and loop, and perform m number of walks. You will write a function called random_walk_2d that will perform a…arrow_forwardWrite a program i C language to make the RGB LED start in the Red color state, then fade to Green, then fade to Blue and finally back to the Red color. Complete the code that is giving in the picture. Remember, the LED should FADE from a color to another. So, make sure that the LED fade.arrow_forwardWrite a program Using Digital Differential Analyzer algorithm that allows users to create a picture as a set of straight-line segments drawn between specified endpoints. The coordinates of the individual line segments are to be selected with a locator device.arrow_forward
- A robot starts on a point marked “A” on a rectangular grid of points. The starting point is always the top left point on the grid. The robot can move left, right, up or down, moving from one point to the next. By moving in steps going left, right, up or down, the robot would like to reach a point marked “B”, which is always the bottom right point in the grid. Sometimes, points are marked as “x”, and the robot is not allowed to visit them at all. A robot is never allowed to visit a point more than once. In how many ways can the robot move from A to B and visit all points along the way? For example, in the following grid, represented in text as A . . . . B there is only one path from A to B: In the following grid, represented in text as A . . x x B there is still only one path (we're lucky because of the two x's): However, in the grid A . . . x B there are no ways for the robot to move from A to B and visit all points that are not marked with “x”. Write a single…arrow_forwardPlease using python to implement the following task. Given a RGB color image ‘test.jpg’ noised by salt and pepper noise, first choose a good filter to remove noise on each channel, then based on the gray image of this new RGB color image, use canny edge detection to get edges. Finally show the original image and its edge image.arrow_forwardMake me a model in an engineering software, which allows to represent the magnetic field of a three-phase rotating electric machine.1.A scenario in which you can modify: frequency, modulus of the magnetic field density, initial angle.2.To allow the user to modify the radius of the electric machine casing.3.Allow to re-simulate a new magnetic field distribution or to exit the simulation. in matlabarrow_forward
- Write a triangle (x0, y0, x1, y1, x2, y2) function to draw the triangle with vertices (x0, y0), (x1, y1), and (x2, y2). Use your function to draw some triangles. www..arrow_forwardImplement the problem below in Python using mpi4py. Submit the code of your program and a brief report. The report should describe the design of your program, and demonstrate the results of running your program. n-body solver. Implement a parallel n-body solver with n = 10 particles. You may randomly generate the masses, initial velocities, and initial positions of all particles at the beginning. Compute the positions of all particles after 1 second. Compare the results by using 0.1s, 0.01s, and 0.001s as the time in each timestep, respectively.arrow_forwardThe Problem: You are coding a graphics filter that process each of an image through a filter. Each pixel is defined a triplet of real numbers (R,G,B) each of which is between 0 and 255.The filtering algorithms need to work on real numbers in order to do their job. But examining the program you discover that they only need two digits of accuracy. Any additional digits is just overkill.arrow_forward
- Write a program (in MATLAB) to read how many pixels are in "cameraman.tif", and add a white vertical line in the center of the ?(image (cameraman.tifarrow_forwardWrite a program in C language that makes it look like the light is scrolling through 4 LEDs that are connected externally. The scroll effect can be achieved by turning LEDs ON and OFF sequentially.arrow_forwardProgram a simplified Galton board in python. It is required that: The user must select the number of rows n of the board The distribution resulting from dropping the beads should be displayed on the screen. Display an animation where the number of rows n increases over time.All resulting distributions must be scaled to the interval [0, 1], so that it is possible toappreciate the convergence to the normal distribution. Consider n from 1 to 80.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education