how to write a simple ellipse equation (x^2/a^2) + (y^2/b^2) = 1 in Python? Solu
ID: 3652094 • Letter: H
Question
how to write a simple ellipse equation (x^2/a^2) + (y^2/b^2) = 1 in Python?Explanation / Answer
#the penultimate for ellipses import time print ("Do have a width/height for your ellipse?") size = input() if size == 'yes' or size == 'y': print ('First, give me the "width".') Lh = input() Lh = int(Lh) print ('Great! Now, go ahead and give me the "height" please.') Ht = input () Ht = int(Ht) print ("Awesome. Now, I gotta work some magic, so give me one second....Done.") time.sleep(2) print ("So, this is what I got overall. If I'm wrong, don't hate the program, hate Thomas.") time.sleep(3) if Lh > Ht: A = Lh A = int(A) B = Ht B = int(B) A = (A / 2.000) B = (B / 2.000) A = (A * A) B = (B * B) if Ht > Lh: A = Ht A = int(A) B = Lh B = int(B) A = (A / 2.000) B = (B / 2.000) A = (A * A) B = (B * B) print ("Is it this?") time.sleep(2) A = str(A) B = str(B) print (" X² Y²") print ("--- + --- = 1") print ("" + A + " " + B) time.sleep(5) print ("Ok, I'm sure you're done oohing and such, right?") time.sleep(3) print ("But I haven't even shown you the folci, so might as well show you that too.") time.sleep(3) print ("I'm sorry to say, but my computer cannot make 'v' sign really work well.") print ("It gets...messy.") time.sleep(4) print ("So instead I'll give you the unsimplified form...") print ("I know, I know, it's like you have to actually do SOME work >.>") time.sleep(4) print ("Well....whatever. The answer happens to be...") A = float(A) B = float(B) C = A - B C = str(C) print ("v" + C) time.sleep(3) print ("So There.") print ("Based off of your height and width you have finished the math problem.") if size == 'no' or size == 'n': print ("Well, does it have a vertices AND co-vertices? Yes or no?") orien = input() if orien == 'yes' or 'y': print ("Is the vertice X? yes or no?") xvert = input() if xvert == 'yes' or 'y': print ("What the positive X?") xvertice = input() print ("What is the positive y co-vertice?") yvertice = input() if xvertice > yvertice: A = xvertice A = int(A) B = yvertice B = int(B) A = (A / 2.000) B = (B / 2.000) A = (A * A) B = (B * B) if yvertice > xvertice: A = yvertice A = int(A) B = xvertice B = int(B) A = (A / 2.000) B = (B / 2.000) A = (A * A) B = (B * B) print ("Is it this?") time.sleep(2) A = str(A) B = str(B) print (" X² Y²") print ("--- + --- = 1") print ("" + A + " " + B) time.sleep(5) print ("Ok, I'm sure you're done oohing and such, right?") time.sleep(3) print ("But I haven't even shown you the folci, so might as well show you that too.") time.sleep(3) print ("I'm sorry to say, but my computer cannot make 'v' sign really work well.") print ("It gets...messy.") time.sleep(4) print ("So instead I'll give you the unsimplified form...") print ("I know, I know, it's like you have to actually do SOME work >.>") time.sleep(4) print ("Well....whatever. The answer happens to be...") A = float(A) B = float(B) C = A - B C = str(C) print ("v" + C) time.sleep(3) print ("So There.") print ("Based off of your height and width you have finished the math problem.") if xvert == 'no' or 'n': print ("What is the y positive vertice?") yvertice = input() print ("What is the x positive co-vertice?") xvertice = input() if yvertice > xvertice: A = yvertice A = int(A) B = xvertice B = int(B) A = (A / 2.000) B = (B / 2.000) A = (A * A) B = (B * B) if xvertice > yvertice: A = xvertice A = int(A) B = yvertice B = int(B) A = (A / 2.000) B = (B / 2.000) A = (A * A) B = (B * B) print ("Is it this?") time.sleep(2) A = str(A) B = str(B) print (" X² Y²") print ("--- + --- = 1") print ("" + A + " " + B) time.sleep(5) print ("Ok, I'm sure you're done oohing and such, right?") time.sleep(3) print ("But I haven't even shown you the folci, so might as well show you that too.") time.sleep(3) print ("I'm sorry to say, but my computer cannot make 'v' sign really work well.") print ("It gets...messy.") time.sleep(4) print ("So instead I'll give you the unsimplified form...") print ("I know, I know, it's like you have to actually do SOME work >.>") time.sleep(4) print ("Well....whatever. The answer happens to be...") A = float(A) B = float(B) C = A - B C = str(C) print ("v" + C) time.sleep(3) print ("So There.") print ("Based off of your height and width you have finished the math problem.") if orien == 'no' or 'n': print ("Does it have a foci and co-vertices?") foci = input() if foci == 'yes' or 'y': print ("Is the foci on the X axis?") foxi = input() if foxi == 'yes' or 'y': print ("What is the positive foci?") pfoci = input() print ("What is the positive co-vertices?") pcovert = input() if pfoci > pcovert: A = pfoci A = int(A) B = pcovert B = int(B) A = (A / 2.000) B = (B / 2.000) A = (A * A) B = (B * B) if pcovert > pfoci: A = pcovert A = int(A) B = pfoci B = int(B) A = (A / 2.000) B = (B / 2.000) A = (A * A) B = (B * B) print ("Is it this?") time.sleep(2) A = str(A) B = str(B) print (" X² Y²") print ("--- + --- = 1") print ("" + A + " " + B) time.sleep(5) print ("Ok, I'm sure you're done oohing and such, right?") time.sleep(3) print ("But I haven't even shown you the folci, so might as well show you that too.") time.sleep(3) print ("I'm sorry to say, but my computer cannot make 'v' sign really work well.") print ("It gets...messy.") time.sleep(4) print ("So instead I'll give you the unsimplified form...") print ("I know, I know, it's like you have to actually do SOME work >.>") time.sleep(4) print ("Well....whatever. The answer happens to be...") A = float(A) B = float(B) C = A - B C = str(C) print ("v" + C) time.sleep(3) print ("So There.") print ("Based off of your height and width you have finished the math problem.") if foxi == 'no' or 'n': print ("What is the positive part of the foci?") pfoci = input() print ("What is the positive co-vertices?") pcovert = input() if pfoci > pcovert: A = pfoci A = int(A) B = pcovert B = int(B) A = (A / 2.000) B = (B / 2.000) A = (A * A) B = (B * B) if pcovet > pfoci: A = pcovert A = int(A) B = pfoci B = int(B) A = (A / 2.000) B = (B / 2.000) A = (A * A) B = (B * B) print ("Is it this?") time.sleep(2) A = str(A) B = str(B) print (" X² Y²") print ("--- + --- = 1") print ("" + A + " " + B) time.sleep(5) print ("Ok, I'm sure you're done oohing and such, right?") time.sleep(3) print ("But I haven't even shown you the folci, so might as well show you that too.") time.sleep(3) print ("I'm sorry to say, but my computer cannot make 'v' sign really work well.") print ("It gets...messy.") time.sleep(4) print ("So instead I'll give you the unsimplified form...") print ("I know, I know, it's like you have to actually do SOME work >.>") time.sleep(4) print ("Well....whatever. The answer happens to be...") A = float(A) B = float(B) C = A - B C = str(C) print ("v" + C) time.sleep(3) print ("So There.") print ("Based off of your height and width you have finished the math problem.") if foci == 'no' or 'n': print ("Well, is it a vertex and co-vertex problem? yes or no.") vertil = input() if vertil == 'yes' or 'y': print ("Is the vertex X? yes or no") verib = input() if verib == 'yes' or 'y': print ("What is the positive X vertex?") pxvertex = input() print ("What is the postive y co-vertex?") pyvertex = input() if pxvertex > pyvertex: A = pxvertex A = int(A) B = pyvertex B = int(B) A = (A / 2.000) B = (B / 2.000) A = (A * A) B = (B * B) if pyvertex > pxvertex: A = pyvertex A = int(A) B = pxvertex B = int(B) A = (A / 2.000) B = (B / 2.000) A = (A * A) B = (B * B) print ("Is it this?") time.sleep(2) A = str(A) B = str(B) print (" X² Y²") print ("--- + --- = 1") print ("" + A + " " + B) time.sleep(5) print ("Ok, I'm sure you're done oohing and such, right?") time.sleep(3) print ("But I haven't even shown you the folci, so might as well show you that too.") time.sleep(3) print ("I'm sorry to say, but my computer cannot make 'v' sign really work well.") print ("It gets...messy.") time.sleep(4) print ("So instead I'll give you the unsimplified form...") print ("I know, I know, it's like you have to actually do SOME work >.>") time.sleep(4) print ("Well....whatever. The answer happens to be...") A = float(A) B = float(B) C = A - B C = str(C) print ("v" + C) time.sleep(3) print ("So There.") print ("Based off of your height and width you have finished the math problem.") if verib == 'no' or 'n': print ("What is the positive Y vertex?") pyvertex = input() print ("What is the positive x co-vertex?") pxvertex = input() if pyvertex > pxvertex: A = pyvertex A = int(A) B = pxvertex B = int(B) A = (A / 2.000) B = (B / 2.000) A = (A * A) B = (B * B) if pxvertex > pyvertex: A = pxvertex A = int(A) B = pyvertex B = int(B) A = (A / 2.000) B = (B / 2.000) A = (A * A) B = (B * B) print ("Is it this?") time.sleep(2) A = str(A) B = str(B) print (" X² Y²") print ("--- + --- = 1") print ("" + A + " " + B) time.sleep(5) print ("Ok, I'm sure you're done oohing and such, right?") time.sleep(3) print ("But I haven't even shown you the folci, so might as well show you that too.") time.sleep(3) print ("I'm sorry to say, but my computer cannot make 'v' sign really work well.") print ("It gets...messy.") time.sleep(4) print ("So instead I'll give you the unsimplified form...") print ("I know, I know, it's like you have to actually do SOME work >.>") time.sleep(4) print ("Well....whatever. The answer happens to be...") A = float(A) B = float(B) C = A - B C = str(C) print ("v" + C) time.sleep(3) print ("So There.") print ("Based off of your height and width you have finished the math problem.") if vertil == 'no' or 'n': print ("Well, there you have it.") print ("This took me almost all night.") print ("in fact...") time.sleep(4) print ("The total amount of lines is about 400 lines of code!")
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.