Write a function interpolate_1d(data,targ)

Assignment Help Programming Languages
Reference no: EM131395645

EXERCISE- HYDROSTATIC AND STABILITY CALCULATOR

This exercise will use the Bonjean curves to determine the hydrostatics of a ship at any required draught. As discussed last week the Bonjean curves are a powerful way of expressing sectional area data with respect to the baseline of the ship. This provides a curve of area with respect to draught. A full set of these curves for an entire vessel can be very useful for the calculation of a ships hydrostatics at varying conditions or attitudes. Take for example a ship sitting on a wave, Figure 1.

Knowing the draught at every station and using the Bonjean curves, the area at each station can be found. With this information the immersed volume of the ship and the position of the centre of buoyancy can be calculated using numerical integration. The results of which can determine whether the vessel will heave upwards or downwards and trim bow down or bow up.

Figure 1 Ship on a wave

This exercise will interpolate the Bonjean data for a target draught, essentially providing the sectional area of the ship. As an example, in order to get the volumetric displacement of the ship at the target waterline, we will then conduct a numerical integration of the sectional area data.

This process of numerical integration can be used to calculate all the required hydrostatics as outlined below.

ASSIGNMENT

Create a file named ex2_[student number].py. Import the contents from the week 1 exercises using the command:

Import ex1_[student number] as ex1

The objective of this assignment is to write the tools required to create a dictionary of hydrostatics.

The process will be broken down into stages. Your assignment is to write the following functions and include them in the file ex2_[student number].py: As you will see there are examples that use the functions developed in Exercise 1. If you are confident in the correctness of these functions then import your file using: import [student number]_ex1 as ex1. However, if you are not confident then I have included my functions on blackboard for you to import using: import Boyd_ex1 as ex1. Download Boyd_ex1.pyc and place this in your working folder.

? Write a function interpolate_1D(data,targ) where data is a list of tuples representing x and y data and targ is the target value of y. The function should return the interpolated value of x.

This function must not allow for extrapolation but return:

? the largest available x value if the target is higher than the largest value of z in data and

? zero if the target is lower than the smallest value of z in data

? Write a function trap_area(xdata, ydata) where xdata and ydata are lists of coordinates representing a curve. The function should return the area under the ydata with respect to the xdata, as a float, using the trapezium rule.

? Write a function trap_area(xdata, ydata) where xdata and ydata are lists of coordinates representing a curve. The function should return the area under the ydata with respect to the xdata, as a float, using the trapezium rule.

Where A(x) is the Bonjean area at any given section to a given waterline. The function given in equation (1) is integrated between A/2 and -A/2 where A is the length of the ship between AP and FP, i.e. A = 0 is amidships.

Reference no: EM131395645

Questions Cloud

Relevance of social psychology in a work place : What is the relevance of social psychology in a work place?
Develop an implementation plan for key objectives : Method of obtaining necessary approval(s) and securing support from your organization's leadership and fellow staff.Description of current problem, issue, or deficit requiring a change. Hint: If you are proposing a change in current policy, process,..
Deborah consume before the price change : Suppose that with a budget of $200, Deborah spends $120 on sushi and $80 on bagels when sushi costs $2 per piece and bagels cost $2 per bagel. But then, after the price of bagels falls to $1 per bagel, she spends $50 on sushi and $50 on bagels.
Discuss the big five personality test : Discuss the strengths and limitations of dispositional and evolutionary or biological personality theories as they apply to behavior. Discuss the Big Five personality test and how it is used to study personality
Write a function interpolate_1d(data,targ) : Write a function interpolate_1D(data,targ) where data is a list of tuples representing x and y data and targ is the target value of y. The function should return the interpolated value of x.
Draft of the costs of production : Prompt: Submit a draft of the Costs of Production (Section IV), Overall Market (Section V), and Recommendation (Section VI) of your research paper, including all critical elements listed below.
How you as a supervisor would resolve the issue : Julie and Judy have been the two front desk receptionists for the last five years. How would you handle this situation and why? How you as a supervisor would resolve the issue or issues causing the conflict
Calculate elasticity of demand : Calculate elasticity of demand do you use point elasticity or arc elasticity of demand formula
Referencing a topic that relates to a macroeconomic issue : Simply select a credible media source, pick an article referencing a topic that relates to a macroeconomic issue, (i.e., unemployment, inflation, world trade, banking, money supply,etc) and write a report on how the information in the article rela..

Reviews

Write a Review

Programming Languages Questions & Answers

  Estimate the storage space for telephone book

Estimate the storage space (number of bytes) required for each of the following items: A telephone book with 10,000 entries consisting of names, addresses and phone numbers. Use your phone book to estimate the average length of an entry.

  Create a program that has an object type of contact

Create a program that has an object type of Contact. This contact will need to have the following attributes: Name, Birth Date, Phone Number, Address and Eye Color.

  1 microsoft is developing a new program and they want to

1. microsoft is developing a new program and they want to identify the break-even point.their fixed cost is 72000 while

  Write application to calculate average of temperature

Write the application to calculate average of set of temperature readings. Application prompts user to enter the number of temperature readings to be entered, then prompts user to enter temperature.

  Write a program using binary search approach

Write a program using binary search approach

  Create mock level design for game

Write a 5-page "mock level design" in which you design a level for a game. The game is a shooter, the level is an old warehouse filled with zombies and demons with a boss at the end.

  Design a class-based solution to a problem

To design a class-based solution to a problem using multiple data structures.

  Design fraction class to represent numerator and denominator

Design a fraction class. The class should have 2 data members to represent the numerator and denominator. Both of these numbers should obviously be integers.

  Write a test plan to test the program

The local yogurt shop is expanding its selection of frozen treats, and would like you to modify the program you wrote to calculate and print their customer's bills. You will also write a test plan to test the program.

  Make simple html document add a comment

Make simple html document Add a comment Add a hyperlink to www.google.com Create simple HTML headings h1 to h6

  Write code using while loop for data validation

Write code or pseudo code using while loops to do Data Validation for following user prompts:input positive # input negative # input number between 1 and 100, inclusive.

  Design and implement program that creates exception class

Design and implement a program that creates an exception class called StringTooLongException, designed to be thrown when a string is discovered that has too many characters in it

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd