matlab
Problems for Programming Languages (Courtesy of CSIS Professor Heiner)
Hypotenuse of a Triangle Write a function that takes as input the base and height of a right triangle and then computes the hypoteneuse as output. Volume of a Sphere Write a function that takes as input the radius and then computes the volume of a sphere as output. Hadamard Product Write a function that takes as input two vectors of numbers and then computes their Hadamard product. Running Sum and Product of a List of Numbers Write a function that takes as input a vector of numbers and a possible a procedure. Then apply the procedure to the list of numbers. At a minimum you must be able to find the sum of the list of numbers and the product of the list of numbers. First n Square Numbers Write a function that takes as input an integer n and returns a vector of the first n square numbers. Min Write a function taking as input a sequence of numbers and then produces as output the minimum.
State of Water Write a function that takes as input the temperature of water in degrees Fahrenheit and then computes the state of the water(solid, liquid, or gas) as output. Double Sequence Write a function that takes as input a vector of numbers and then computes that sequence doubled.
Translation Write a function that takes as input a vector of words (such as one two three four five) and then returns that sequence of words translated into a language of your choice. Nest Level Write a function that takes as input a list of nested lists (a matrix or tensor) that contain items and an item to search for and outputs the nest level of the item you are searching for.
Duplicate Sequence Write a function that takes as input a vector of numbers and then computes an output vector with every element in the original vector appearing twice. Example: input [1 3 0] ĺ output [1 1 3 3 0 0] Remove Duplicates Write a function that takes as input a vector of numbers and then outputs a sequence with any duplicates in the original sequence removed. Example: input [2 1 1 0 5 0 1] ĺ output [2 1 0 5] Count Articles Write a function that takes as input a vector of strings and then produces as output a count of the strings that are articles(a, an, the). List of Colors Write a function that takes as input a vector of strings and then produces as output a vector of those strings from the input that are colors. You may assume that a color will not appear more than once in the input. You must be able to recognize black, brown, blue, red, yellow, orange, purple, green, gray, and pink. List of Positives Write a function that takes as input a vector of numbers and then produces as output a vector of those numbers from the input that are positive. Youngest Person Write a function that takes as input a sequence (matrix) of people where each person has a name and an age and produce as output the name of the youngest person.
Commented [EF 1]: We've already covered these.
Commented [EF 2]: These are TOO EASY.
Commented [EF 3]: These are TOO HARD.
Commented [E4]: These six are JUST RIGHT. Do them for 2 points each of extra credit.