Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CODE IN PYTHON, GETTING ONLY 66 PERCENT 5 points Plot exact and inexact Fahrenheit-Celsius conversion formulas A simple rule to quickly compute the Celsius temperature

image text in transcribedimage text in transcribed

CODE IN PYTHON, GETTING ONLY 66 PERCENT

5 points Plot exact and inexact Fahrenheit-Celsius conversion formulas A simple rule to quickly compute the Celsius temperature from the Fahrenheit degrees is to subtract 30 and then divide by 2: F - 30 ca 2 Compare this curve against the exact curve C = 5 (F 32) in a plot. Let F vary between -20 and 120 with 101 points. You should include both the approximate and exact formulae, and the absolute value of their difference (the error). You will need to: plot the data using a black dashed line ( '--') for the approximate formula; a black solid line for the accurate formula; and a black dotted line (':') for the error (preserve this order!) change the plot range to match the specification above (use the plt.xlins a,b ) function, where you provide a and b) add axes labels to your plot, 'temperature / F' and 'temperature / C'. Your submission should include a plot. Make sure to import matplotlib.pyplot as plt. Use plt.plot but not plt.show in your submission. (This assignment is based on Langtangen, Exercise 5.12.) Answer* 1 import matplotlib.pyplot as plt 2 import numpy as np 3 x=np. linspace(-20,120,101); 4 y1=(5.0/9.0)*(x-30); 5 y2=(x-30)/2.0; 6 plt.plot(x,y2,'--'); 7 plt.plot(x,y1,'-k'); 8 plt.plot(x, abs(y1-y2),':k'); 9 plt.xlim(-20,120); 10 plt.xlabel("temperature / F"); 11 plt.ylabel ("temperature / C"); 12 plt.show()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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_2

Step: 3

blur-text-image_3

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

OCA Oracle Database SQL Exam Guide Exam 1Z0-071

Authors: Steve O'Hearn

1st Edition

1259585492, 978-1259585494

More Books

Students also viewed these Databases questions

Question

What is the basis for Security Concerns in Cloud Computing?

Answered: 1 week ago

Question

Describe the three main Cloud Computing Environments.

Answered: 1 week ago