Question:
Using this code as a starting point, restructure the solution so that each sub-task (there are three) is performed in its own, separate function. When done, the function toDecimal should (1) do none of the actual "work" itself and (2) should call three separate functions in an appropriate order to complete the conversion process. This is similar to the work you did in exercise 6.4 (cengage mindtap) to restructure function newton. However, there is no recursion involved in this code.
CODE:
def toDecimal(rep, base):
"""
Converts a number in any base from 2 to 16 to a decimal (base 10)
equivalent value.
Parameters
----------
rep : string
A string representation of an integer value in some base.
base : integer
An integer representing the base.
Returns
-------
decimal : integer
The base-10 value of the provided representation
"""
# The conversion table for bases up to 16
repTable = {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, ‘5': 5, '6':6, '7': 7,
'8': 8, '9': 9, 'A': 10, 'B': 11, 'C': 12, 'D': 13, 'E': 14,'F': 15}
# Make sure that the offered string has SOME data, otherwise, return zero
if len(rep) < 1:
return 0
# The base must be between 2 and 16, inclusive, else return 0
elif base < 2 or base > 16:
return 0
else:
# The arguments are good, let's go
decimal = 0
exp = len(rep) - 1
for digit in rep:
decimal += repTable[digit] * base ** exp
exp -= 1
return decimal
In: Computer Science
1. Given parametric equations below, find dy/dx , equations of the tangent and normal line at the given point.
(a) x = t^2 , y = t^3−3t at t = 1
(b) x = cos(t), y = sin(2t) at t = π/4
2. ) Given parametric equations below, find d^2y/dx^2 and determine the intervals on which the graph of the curve is concave up or concave down.
(a) x = t^2 , y = t^3−3t
(b) x = cos(t), y = sin(2t)
In: Math
Use the table below to answer questions 1 and 2.
Price Quantity Demanded Quantity Supplied
$8 200 1,000
$6 400 800
$4 600 600
$2 800 400
1. Setting a price floor of $8 would cause a market surplus in the
amount of:
a. 400 units. b. 500 units. c. 600 units. d. 800 units.
2. Setting a price ceiling of $2 would cause a market shortage in
the amount of:
a. 400 units. b. 500 units. c. 600 units. d. 800 units.
In: Economics
Suppose you purchase a $1,000 TIPS on January 1, 2016. The bond carries a fixed coupon of 1 percent. Over the first two years, semiannual inflation is 2 percent, 2 percent, 4 percent, and 2 percent, respectively. For each six-month period, calculate the accrued principal and coupon payment. (Do not round intermediate calculations. Round your answers to 2 decimal places.)
|
In: Finance
Java:
Determine the ouotput of this code
ArrayList<String>list=new ArrayList<String>();
list.add("Namath");
list.add("Sauer");
list.add("Maynard");
list.add("Namath");
list.add("Boozer");
list.add("Snell");
list.add("Namath");
list.add("Atkinson");
list.add("Lammonds");
list.add("Dockery");
list.add("Darnold");
list.remove(2);
list.set(2, "Brady");
list.remove(2);
list.set(4,"Unitas");
list.add(1,"Lamomica");
list.add(3,"Hanratty");
list.remove("Namath");
list.remove(list.size()-1);
list.remove(2);
list.set(7, "Riggins");
Iterator iter = list.iterator();
while (iter.hasNext())
{ System.out.print(iter.next() + " ");
}
}
}
In: Computer Science
Discrete random
variables X and Y have joint probability mass function defined by
the table below.
X= { 0 , 1 , 2 } , Y= { − 2 , 0 , 2 }
| y/x | 0 | 1 | 2 |
| -2 | 0.2 | 0.1 | 0.1 |
| 0 | 0.0 | 0.4 | 0.0 |
| 2 | 0.1 | 0.0 | 0.1 |
A.) Evaluate the expected value of X (round to 2 decimal digits)
B.) Evaluate the variance of X (round to 2 decimal digits)
C.) Evaluate the covariance of X and Y. (round to 2 decimal digits) Are X and Y independent?
D.) Let W=3X-2Y+4. What is the mean of W? What is the standard deviation of W? (round to 2 decimal digits)
In: Statistics and Probability
The owner of a moving company usually has her most experienced manager predict the total number of labor hours required to complete a move. While useful, the owner is interested in a more accurate method of predicting the number of labor hours required. As a preliminary effort, data was collected on the number of work hours required to complete a move, number of cubic feet moved, the number of large pieces, and if an elevator was present.
How much correlation is there between the variables?
How much of the variability in strength is explained by the predictors?
Which of the predictor variables are significant at the 0.05 level?
At the 0.05 level of significance, what is the conclusion about the overall model hypothesis test?
What is the 90% confidence interval around the variable Elevator?
How are the degrees of freedom residuals computed?
At α = 0.001, is the overall model significant?
Estimate the number of hours required when 325 cubic feet are moved with 3 large pieces of furniture and no elevator is present.
Estimate the number of hours required when 425 cubic feet are moved with 7 large pieces of furniture and an elevator is present.
Estimate the number of hours required when 375 cubic feet are moved with 2 large pieces of furniture and no elevator is present.
| Hours | Feet | Large | Elevator |
| 24.00 | 545 | 3 | Yes |
| 13.50 | 400 | 2 | Yes |
| 26.25 | 562 | 2 | No |
| 25.00 | 540 | 2 | No |
| 9.00 | 220 | 1 | Yes |
| 20.00 | 344 | 3 | Yes |
| 22.00 | 569 | 2 | Yes |
| 11.25 | 340 | 1 | Yes |
| 50.00 | 900 | 6 | Yes |
| 12.00 | 285 | 1 | Yes |
| 38.75 | 865 | 4 | Yes |
| 40.00 | 831 | 4 | Yes |
| 19.50 | 344 | 3 | Yes |
| 18.00 | 360 | 2 | Yes |
| 28.00 | 750 | 3 | Yes |
| 27.00 | 650 | 2 | Yes |
| 21.00 | 415 | 2 | No |
| 15.00 | 275 | 2 | Yes |
| 25.00 | 557 | 2 | Yes |
| 45.00 | 1028 | 5 | Yes |
| 29.00 | 793 | 4 | Yes |
| 21.00 | 523 | 3 | Yes |
| 22.00 | 564 | 3 | Yes |
| 16.50 | 312 | 2 | Yes |
| 37.00 | 757 | 3 | No |
| 32.00 | 600 | 3 | No |
| 34.00 | 796 | 3 | Yes |
| 25.00 | 577 | 3 | Yes |
| 31.00 | 500 | 4 | Yes |
| 24.00 | 695 | 3 | Yes |
| 40.00 | 1054 | 4 | Yes |
| 27.00 | 486 | 3 | Yes |
| 18.00 | 442 | 2 | Yes |
| 62.50 | 1249 | 5 | No |
| 53.75 | 995 | 6 | Yes |
| 79.50 | 1397 | 7 | No |
In: Statistics and Probability
| Quantity | TC | Price of | TR | ATC | AVC | MC | MR | MR-MC | Profit | change in | |
| good | profit | ||||||||||
| 0 | 10 | 5 | 0 | ||||||||
| 1 | 15 | 5 | 5 | 15 | 5 | 5 | 5 | ||||
| 2 | 18 | 5 | 10 | 9 | 4 | 3 | 5 | ||||
| 3 | 20 | 5 | 15 | 6.67 | 3.33 | 2 | 5 | ||||
| 4 | 21 | 5 | 20 | 5.25 | 2.75 | 1 | 5 | ||||
| 5 | 23 | 5 | 25 | 4.6 | 2.6 | 2 | 5 | ||||
| 6 | 26 | 5 | 30 | 4.33 | 2.67 | 3 | 5 | ||||
| 7 | 30 | 5 | 35 | 4.29 | 2.86 | 4 | 5 | ||||
| 8 | 35 | 5 | 40 | 4.38 | 3.13 | 5 | 5 | ||||
| 9 | 41 | 5 | 45 | 4.56 | 3.44 | 6 | 5 | ||||
| 10 | 48 | 5 | 50 | 4.8 | 3.8 | 7 | 5 | ||||
| 11 | 56 | 5 | 55 | 5.09 | 4.18 | 8 | 5 | ||||
This is a firm in a perfectly competitive market. The selling price is $5.
Fill in the table
At what price will you be minimizing losses?
There are 2 ways of calculating the change in total profits. List and explain what information you would use.
In: Economics
java by using Scite Objectives:
1. Create one-dimensional arrays and two-dimensional arrays to solve problems
2. Pass arrays to method and return an array from a method
Problem 2: Find the largest value of each row of a 2D array
(filename: FindLargestValues.java)
Write a method with the following header to return an array of integer values which are the largest values from each row of a 2D array of integer values
public static int[] largestValues(int[][] num)
For example, if the 2D array passed to the method is:
8 5 5 6 6
3 6 5 4 5
2 5 4 5 2
8 8 5 1 6
The method returns an array of integers which are the largest values from each row as follows:
8
6
5
8
In the main method, create a 2D array of integer values with the array size 4 by 5 and invoke the method to find and display the largest values from each row of the 2D array.
You can generate the values of the 2D array using the Math.random() method with the range from 0 to 9.
In: Computer Science
Implementation in CLIPS programming language for the following problem
Acme Electronics makes a device called the Thing 2000. This device is available in five different models distinguished by the chassis. Each chassis provides a number of bays for optional gizmos and is capable of generating a certain amount of power. The following table sumarizes the chassis attributes:
Chassis --------- Gizmo Bays provided --- Power Provided-----
Price($)
C100--------------------------- 1---------------------------
4------------------ 2000
C200------------------------- 2 --------------------------
5------------------ 2500
C300--------------------------- 3---------------------------7
------------------3000
C400---------------------------2----------------------------8------------------
3000
C500-------------------------- 4 ---------------------------9
------------------3500
Each gizmo that can be installed in the chassis requires a certain amount of power to operate. The following table summarizes the gizmo attributes
Gizmo-------------------- Power Used --------------------Price($)
Zaptron ------------------------ 2
------------------------------100
Yatmizer ----------------------- 6------------------------------
800
Phenerator--------------------- 1
------------------------------300
Malcifier----------------------- 3
------------------------------200
Zeta-shield------------------- 4
------------------------------150
Warnosynchronizer---------- 2
-------------------------------50
Dynoseparator---------------- 3
------------------------------400
Given as input facts representing the chassis and any gizmos that have been selected, write a program that generates facts representing the number of gizmos used, the total amount of power required for the gizmo, and the total price of the chassis and all gizmos selected
In: Advanced Math