1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
HACTEHA [7]
4 years ago
13

Create a function that will perform linear interpolation from a set of measured data stored in a list or array. The function sho

uld take as input a list of values at which samples were taken, and then another list giving the measurements (you can assume each measurement is a single value) at
Computers and Technology
1 answer:
wel4 years ago
8 0

Answer:

This question is incomplete, here is the complete question:

Python

a) You should create a function that will perform linear interpolation from a set of measured data. The function should take as input a list of values at which samples were taken, and then another list giving the measurements (you can assume each measurement is a single value) at those values. It should also take in a query value, and should give the best estimate it can of the value at that query. Be sure to handle values that are outside of the range, by extrapolating. You should write a program that allows you to test your function by reading the lists from a file where each line of the file is a pair of numbers separated by spaces: the value where the sample was taken, and the measurement at that value. Your program should ask the user for the name of the file and for a query value. Important: The two lists will correspond to each other: i.e. for the i-th value in the first list, the measurement will be the i-th element of the second list (these are called parallel lists or arrays). But, you should not assume that the input values are in increasing/decreasing order. That is, the values in the first list can be in any random ordering, not necessarily from smallest to largest or largest to smallest. You will have to account for this in your program, and there is more than one way to do so. You should discuss what options you can think of to handle the data arriving in any order like that, and decide what you think the best option for handling it is.

Explanation:

from __future__ import division

from cStringIO import StringIO

import numpy as np

from scipy.interpolate import RectBivariateSpline

np.set_printoptions( 1, threshold=100, edgeitems=10, suppress=True )

   # a file inline, for testing --

myfile = StringIO( """

# T P1 P2 P3 P4

0,   80,100,150,200

75, 400,405,415,430

100, 450,456,467,483

150, 500,507,519,536

200, 550,558,571,589

""" )

   # file -> numpy array --

   # (all rows must have the same number of columns)

TPU = np.loadtxt( myfile, delimiter="," )

P = TPU[0,1:] # top row

T = TPU[ 1:,0] # left col

U = TPU[1:,1:] # 4 x 4, 400 .. 589

print "T:", T

print "P:", P

print "U:", U

interpolator = RectBivariateSpline( T, P, U, kx=1, ky=1 ) # 1 bilinear, 3 spline

   # try some t, p --

for t, p in (

   (75, 80),

   (75, 200),

   (87.5, 90),

   (200, 80),

   (200, 90),

   ):

   u = interpolator( t, p )

   print "t %5.1f p %5.1f -> u %5.1f" % (t, p, u)

You might be interested in
Sammy's Seashore Supplies rents beach equipment such as kayaks, canoes, beach chairs, and umbrellas to tourists. Write a program
murzikaleks [220]

Answer:

// here is code in java.

import java.util.*;

// class definition

class SammysRentalPrice

{

// main method of the class

public static void main(String[] args) {

    // scanner object to read input from user

    Scanner s=new Scanner(System.in);

      // ask user to enter year

       System.out.print("Enter the rented minutes:");

       // read minutes

      int min=s.nextInt();

      // find hpurs

      int hours=min/60;

      // rest  of minutes after the hours

      min=min%60;

      // total cost

      int tot_cost=(hours*40)+(min*1);

      // print hours,minute and total cost

      System.out.println("total hours is: "+hours);

      System.out.println("total minutes is: "+min);

      System.out.println("total cost is: "+tot_cost);

     

}

}

Explanation:

Read the rented minutes of an equipment from user with the help of scanner object. Calculate the hours and then minutes from the given minutes.Calculate the cost by multiply 40 with hours and minute with 1.Add both of them, this will be the total  cost.

Output:

Enter the rented minutes:140

total hours is: 2

total minutes is: 20

total cost is: 100

7 0
3 years ago
Megan says she never needs to look at the Transport Layer when she is searching for what went wrong with the network she support
lara31 [8.8K]

I'd say D: Wrong, because transporting information is what a network does, and the Transport Layer is at the heart of that layer.

Transport layer is truly at the heart of the OSI model. Its main function is to transfer application data from the source to destination. This layer provides a reliable end-to-end communication service and transfers data for the user layers above it, as well as shielding the rest of the layers below from details like message error and flow control functions. If packets get destroyed or lost during transmission, it is in the best interest of Megan to check the transport layer. Transport layer ensures that whenever something like this happens, packets must be re-transmitted.

3 0
3 years ago
Read 2 more answers
What aspect should you consider before adding pictures to a document? You should structure the first before you search for a rel
suter [353]

Answer:make sure it line up with tour essay

Explanation:

5 0
3 years ago
Do software engineers save millions of dollars in usa
SCORPION-xisa [38]
Yes. They make a lot of money. So eventually after saving your Money, you will make a least 1 million dollars or more.
4 0
3 years ago
Inside which command group will a user find the ability to configure Outlook rules used to organize a mailbox?
Sauron [17]

Answer:

You can use Outlook to perform diffrent aspects

In the toolbox command

3 0
3 years ago
Other questions:
  • What characteristics need to be exhibited by an organisation to improve its software process?
    7·1 answer
  • To close a tab, click the ____ button in the web page thumbnail on the tab switcher.
    9·1 answer
  • What do you think the need for so many different form factors and server types are?
    13·1 answer
  • What is a DreamScape?<br> Explain <br> and give example (if you want)
    10·1 answer
  • Question 1
    10·1 answer
  • One of the most common causes of fires in the home and workplace is: a. All of the answer choices b. Arson c. Candle d. Faulty e
    6·1 answer
  • Many inventions have enabled us to use digital cameras. The biggest difference between traditional and digital cameras is that d
    10·1 answer
  • In order to place a gradient within a stroked path for type, one must convert the type using the __________
    15·1 answer
  • You are having difficulty changing permissions for a folder on an NTFS volume that was created by another user. How can you best
    6·1 answer
  • Words that are restricted for use in object names because they belong to the SQL programming language are called _______________
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!