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
Temka [501]
3 years ago
10

On a piano, a key has a frequency, say f0. Each higher key (black or white) has a frequency of f0 * r^n, where n is the distance

(number of keys) from that key, and r is 2^(1/12). Given an initial key frequency, output that frequency and the next 4 higher key frequencies. Ex: If the input is 440 (the A key near the middle of a piano keyboard), the output is: 440.0 466.1637615180899 493.8833012561241 523.2511306011974 554.3652619537442 Note: Use one statement to compute r = 2^(1/12) using the RaiseToPower() function. Then use that r in subsequent statements that use the formula fn = f0 * r^n with n being 1, 2, 3, and finally 4.
Computers and Technology
1 answer:
vodomira [7]3 years ago
6 0

Answer:

Following are the code to this question:

import math# import math module

def RaiseToPower():   # defining a function RaiseToPower

   r= math.pow(2,1/12)    # defining r variable that calcualte the decimal point value.

   return r # return r variable value.

f0= float(input()) #defining f0 variable that hold input frequency .

for n in range(0,5):#defining for loop to count all frequency

   fn = f * math.pow(RaiseToPower(),n)    # defining fn variable that calls method RaiseToPower and multiply the value by frequency

   print(fn,end=' ')    # use print method to prints all five frequency

Output:

440

440.0 466.1637615180899 493.8833012561241 523.2511306011974 554.3652619537443

Explanation:

Description of the above python code can be defined as follows:

  • In the above code first we import the package of the math module for converting frequency, after importing package a "RaiseToPower" method is declared, inside the method r variable is declared, that counts decimal value and return its value.
  • In the next step, "f0" a frequency variable is declared that input a value from the user and defined a for loop to in the loop fn variable declared, calls the method and pass its input value and stores its decimal points and at the last print its value.

You might be interested in
What does an effect allow you to do in<br> EarSketch?
Gnoma [55]

Answer:usbebdos did did I’d did d

Explanation:

Bash six ska over five. I did a sis a and

7 0
3 years ago
Un usuario desea conocer de manera descriptiva ,como se lleva a cabo el proceso de solicitud de transferencia monetaria en una p
Rus_ich [418]

Answer:

Research My Friend Use a Translator Promise!!

6 0
3 years ago
Read 2 more answers
When code is compiled it
lesantik [10]

Answer:

A compiler takes the program code (source code) and converts the source code to a machine language module (called an object file). Another specialized program, called a linker, combines this object file with other previously compiled object files (in particular run-time modules) to create an executable file. In short, it's A or D.

5 0
3 years ago
Read 2 more answers
Distinguish between the savings and investment options.
Tanya [424]

Answer:

Savings,                          Investments

{}Certificate of deposit    Mutual fund

{}Account                         Money Market

{}                                        Gold

Explanation:

Savings is the term used to describe the proportion of ones income not spent or kept for spending at a much later date;

Saving methods includes saving money in deposit accounts, pension savings, and cash savings as well as reducing expenditures

Savings differs from investment in the sense that investments involves more risks than savings

Mutual fund

Mutual fund is a financial resource type involving the bringing together of funds gathered from several investors for investment

Money market

The money market involves buying and selling debt investments that are short terms

Gold

Gold investment is a way of diversifying risk through futures and derivatives and futures contracts

Certificate Deposit

Certificate deposit is a fixed term deposit form of savings that provides an interest on the deposit

Account

Savings and current account are meant for saving funds

8 0
3 years ago
Write a program FindDuplicate.java that reads n integer arguments from the command line into an integer array of length n, where
kozerog [31]

Answer:

  1. public class FindDuplicate{
  2.    public static void main(String[] args) {
  3.        Scanner input = new Scanner(System.in);
  4.        int n = 5;
  5.        int arr[] = new int[n];
  6.        for(int i=0; i < arr.length; i++){
  7.            int inputNum = input.nextInt();
  8.            if(inputNum >=1 && inputNum <=n) {
  9.                arr[i] = inputNum;
  10.            }
  11.        }
  12.        for(int j =0; j < arr.length; j++){
  13.            for(int k = 0; k < arr.length; k++){
  14.                if(j == k){
  15.                    continue;
  16.                }else{
  17.                    if(arr[j] == arr[k]){
  18.                        System.out.println("True");
  19.                        return;
  20.                    }
  21.                }
  22.            }
  23.        }
  24.        System.out.println("False");
  25.    }
  26. }

Explanation:

Firstly, create a Scanner object to get user input (Line 4).

Next, create an array with n-size (Line 7) and then create a for-loop to get user repeatedly enter an integer and assign the input value to the array (Line 9 - 14).

Next, create a double layer for-loop to check the each element in the array against the other elements to see if there is any duplication detected and display "True" (Line 21 - 22). If duplication is found the program will display True and terminate the whole program using return (Line 23). The condition set in Line 18 is to ensure the comparison is not between the same element.

If all the elements in the array are unique the if block (Line 21 - 23) won't run and it will proceed to Line 28 to display message "False".

7 0
2 years ago
Other questions:
  • You need to put cabling for connecting two new computers in a room, which did not have any network infrastructure. Because of th
    9·2 answers
  • Which Command Prompt commands in Windows is used for listing a computer connections to shared resources
    10·1 answer
  • In mathematics, the factorial of a positive integer n, denoted as n! , is the product of all positive integers less than or equa
    10·2 answers
  • Which type of chemical bonds are formed by sharing electrons?
    11·1 answer
  • When you park on a hill, think about which way _____.
    6·2 answers
  • Which of the following is true about radio waves? They have short wavelengths. They have high energies. They reveal hot gases. T
    10·2 answers
  • Which of the following statements are true?
    13·1 answer
  • What is the best way to use copyrighted material?
    14·2 answers
  • Most significant effect the rotary press had on printing
    9·1 answer
  • After a Hacker has selects her target, performed reconnaissance on the potential target's network, and probed active Internet Ad
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!