Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function that takes parameters r1 , r2 , n and generates random points (x1,x2) as follows - n random points that lie within

Write a function that takes parameters r1  , r2  , and generates random points (x1,x2)  as follows -

  • random points that lie within a circle with center at (0,0)  and radius r1  →  These points belong to class 'inner'
  • random points that lie outside circle with center at (0,0)  and radius r1  but inside circle with center at (0,0)  and radius r2  →  These points belong to class 'outer'

The function gen_random should return , Cls  :

  • is a numpy array of shape (2n,2)  which has the 2n  random points generated as above.
  • Cls  is a numpy array of shape (2n,)  which contains the value of the class corresponding to each point in (values will be either 'inner' or 'outer')

Step by Step Solution

3.42 Rating (158 Votes )

There are 3 Steps involved in it

Step: 1

CODE import random import numpy as np import math def genrandompointsr1 r2 n X npempty... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Precalculus

Authors: Michael Sullivan

9th edition

321716835, 321716833, 978-0321716835

More Books

Students also viewed these Algorithms questions

Question

What are the principal alloying elements in SAE 4340 steel?

Answered: 1 week ago

Question

Were there conflicts over process goals; how were they resolved?

Answered: 1 week ago