20. Given the following function definition. def combinator(y): return (lambda x: lambda y: x(y))(lambda x:y) What is the result of evaluating the expression combinator(lambda x:x*10) (11) (12)? (A) 100 (C) 132 (E) None of the above 120 (B) (D) Run time error is encountered
Q: Write a Racket function "combine" that takes two functions, f and g, as parameters and evaluates to…
A: Answer :
Q: 2. Write a program that returns the minimum of a single-variable function g(x) in a giver region [a,…
A: It is defined as an interpreted, object-oriented, high-level programming language with dynamic…
Q: Q2/ Write c# function of this following int min ; x = 4; float 2 = 1 ; long y = 1; int a {1,3,9, 10,…
A: As per the given question, we need to implement the following functions in c#: 1. MinMax(a, out m,…
Q: Interesting, intersecting def squares_intersect(s1, s2): A square on the two-dimensional plane can…
A: Actually, given information: A square on the two-dimensional plane can be defined as a tuple (x, y,…
Q: 4. Consider for what value of x are the following function defined? а) f(x) 3 Зх — 2 b) f(x) = 5-x
A: NOTE Below is the answer for the given question. Hope you understand it well. If you have any…
Q: Write a C function that, given a square matrix of floats, finds the diagonal with maximum average…
A: Solution:-- Given question is:-- To write a code in C language that will calculate the average…
Q: Write a C function that, given a square matrix of floats, finds the diagonal with maximum average…
A: #include<stdio.h> #define DIM 200 //return max of averege of all diagonals from matrix M…
Q: (a). Write a class Volume in C++ program to find volume of cube, cylinder and rectangular box using…
A: (a). Write a class Volume in C++ program to find volume of cube, cylinder and rectangular box using…
Q: a. main calls fun1; fun1 calls fun3. b. main calls fun3; fun3 calls fun1. c. main calls fun1; fun1…
A: a. main calls fun1; fun1 calls fun3. Variables Visible: Main: a, f, e & fun1 a,b,c & f un3…
Q: Write a C function that, given a square matrix of floats, finds the diagonal with maximum average…
A:
Q: For the following question assume it is syntactically correct Python code. Given the function call…
A: To Do: To choose the correct option.
Q: Suppose we have g(n) = 2n and h(n) =n3 Below are a number of statements regarding how the functions…
A: The answer is A,D Is true.
Q: Write a C function that, given a square matrix of floats, finds the diagonal with maximum average…
A: #include<iostream>using namespace std;#define DIM 200float matrixMaxDiag(float M[DIM][DIM],int…
Q: Given that a function receives three parameters a, b, c, of type double, write some code, to be…
A: Providing the code in c++ as no coding language is mentioned: #include <iostream>using…
Q: int f(int n) { if ((a >= b) && (c = b) return f(a, c, b); else return f(b, a, c); } To find the…
A: Given function is: int f(int n) { //function declaration if ((a >= b) && (c…
Q: 2. Write a program that returns the minimum of a single-variable function g(x) in a given region [a,…
A: Step 1 INTRODUCTION: Python is a strong general-purpose and high-level programming language. It is…
Q: (a) By defining a lambda function, calculate the function value f(x,) and store it in literal…
A: Here is the code: import numpy as np def simpson(f, x1, x2, n): dx = (x2 - x1) / n x =…
Q: 1. Question : Simplify the following functions using Boolean algebra rules: F1 = a.b+c’+c(a’+b’)…
A: Please refer below for your reference: Due to company's guidelines we are restricted to answer first…
Q: Implement the following functions using PLA Y; = Em(0, 1, 7) Y; = Em(0, 3, 6, 7) Y; = Em(0, 1, 3, 5,…
A: Solution:-
Q: Write a C function that, given a square matrix of floats, finds the diagonal with maximum average…
A: Answer is given below .
Q: The right shift operation is similar to floor division by powers of two. Sample calculation using…
A: Algorithm - Take input from user. Now use the below logic - if not y: return x//1 return…
Q: Use the above three functions to find the taylor expansion of sine for in degrees as given…
A: 1Deg = π/180 Rad = 0.01745Rad
Q: problem 8) Write a function that generates a list of random numbers from a normal distribution. Your…
A: According to our company policy we can answer one question at a time if you want the answer of the…
Q: Consider the continuous function x2 + 2x + 3 if æ < 0 if 0<I< 2 2² + 4x – 7 if 2 < z. f(r) = {r+3…
A: Code: tempFn <- function(xVec){ f = integer(length(xVec)) for (i in seq(1, length(xVec)))…
Q: Let f: A → B be a function with A₁, A₂ ≤ A. Determine if the following stateme true or false. Prove…
A: solutions in below step
Q: If a mocked function includes a difference from the original could a false positive, false…
A: ANSWER: Mocked Function: Mock functions, otherwise called spies, are unique functions that permit us…
Q: Problem 2 Consider the set of mathematical formulas F, Inductively defined as the smallest set that…
A:
Q: Given two vectors of integers (either positive, negative or zeros) vi and v2 of length di and d2…
A: #include<stdio.h> //prodCartFilt function implementation void prodCartFilt(int *v1,int d1,int…
Q: Interesting, intersecting def squares_intersect(s1, s2): A square on the two-dimensional plane can…
A: The given information: def squares_intersect(s1, s2): A square on the two-dimensional plane can be…
Q: In C program Write a function bracket_ by_len that takes a word as an input argument and returns…
A: #include <stdio.h> #include<string.h> /*Define a function bracket_ by_len() that takes a…
Q: Rewrite the following function definitions using lambda notation: f(x) = x + 1 f(x) = x
A: - We need to rewrite the functions as lambda function.
Q: Write Full Program with Function to Implement Following: (one program) 1 - Function name (fnexam) 2…
A: The given is a programming function where the solution is to be provided as a program with a…
Q: 1. Let A = {5, 6, 7, 8} and B = {set of integers}. Illustrate the functionf: p → p + 4. where pE A…
A:
Q: Find the maximum value of the function 2x²+3x+20 where parameter x varies between 10 to 25…
A: The maximum value of function 2x2+3x+20 is 1345.
Q: Implement the following functions with PLA a) F1(A,B,C,D) = Em(0,2,7,10)+ Ed(12,15) b) F2(A,B,C,D) =…
A: To implement the function with PLA.
Q: Write a C function that, given a square matrix of floats, finds the diagonal with maximum average…
A: We need to find the maximum diagonal average of a square matrix in C language.
Q: Suppose that recursive function ???(?) calls itself twice within its body(assume ???(?−1) called 3…
A: Correct answer is (A) O(?) because, The complexity factor of recursive time is O (n ) calculated…
Q: uppose we implement the Fibonacci function without any dynamic programming ptimizations. If we want…
A: Here in this question we have asked that we are using some fibonacci function without dynamic…
Q: 3. Consider a function with polymorphic type f ('a * 'b) -> ( 'b -> 'a) : -> 'a 3.1. What is the…
A: The answer is below for the above given question:
Q: Define a function S : Z+ → Z+ as follows. For each positive integer n, S(n) = the sum of the…
A: function S : Z+ → Z+ as follows. For each positive integer n, S(n) = the sum of the positive…
Q: .. Define and Implement the following functions: float Area Rect(float length, float width) }returns…
A: The Answer start from step-2.
Q: Write Full Program with Function to Implement Following: (one program) in c++ 1 - Function name…
A: 1. we can simply use math function, for example pow to get power and max function, to get max of two…
Q: Problem 2 Consider the set of mathematical formulas F, Inductively defined as the smallest set that…
A: a). Counting numbers called natural numbers start from 1. Now if numbers are positive then f1 and f2…
Q: Refactor the following code using the concept of functions. a = 2 b = 3 C= 4 d = 5 a = 2 b=3 C= 4 d…
A: To do: refactor the given code
Q: PROGRAM EXAMPLE VAR y, n FUNCTION POWER (IN n) BEGIN IF n == 0 THEN return 1 ELSE return y *…
A:
Q: Consider once again the function f(x, y) = x³ cos y + y² √√x. Find an equation of the tangent plane…
A: Task : Given the function. The task is to find the tangent of the function at x = 2 and y = 3.
Q: Given the following code and program output: 10 int main() { 11 int x=5, y=3; 12 string s =…
A: #include <iostream> using namespace std;int add(int a,int b) //add function for line 13{…
Q: A) (let ((x 2) (y 3)) (let ((foo (lambda (z) (+ x y z))) (x 7)) (foo 4))) B) Use COND to implement…
A: A) (let ((x 2) (y 3)) (let ((foo (lambda (z) (+ x y z))) (x 7)) (foo 4))) (let ((x 2) (y 3)) (* x…
Q: The right shift operation is similar to floor division by powers of two. Sample calculation using…
A: In this problem, we need to design the code in the Python programming language. Input - Integer…
Hi, can teach me how to evaluate this step by step thank you!
Please show code and screenshot
Step by step
Solved in 2 steps with 1 images
- F(?,?,?)=?′?′?+?′??+??′?′+??′?can you simplify this and draw the diagram of the simplified functionGiven the following functions:void sum(int a, int b, int total) { total = a+b;}int main() { int x=1, y=2, s=0; sum(x,y,s); cout << s << "\n"; return 0;}1. Explain the problem with the sum function.2. Explain how to fix the problem without changing the main function.Define stubs for the functions get_user_num() and compute_avg(). Each stub should print "FIXME: Finish function_name()" followed by a newline, and should return -1. Each stub must also contain the function's parameters.Sample output with two calls to get_user_num() and one call to compute_avg(): FIXME: Finish get_user_num() FIXME: Finish get_user_num() FIXME: Finish compute_avg() Avg: -1 ''' Your solution goes here ''' user_num1 = 0user_num2 = 0avg_result = 0 user_num1 = get_user_num()user_num2 = get_user_num()avg_result = compute_avg(user_num1, user_num2) print('Avg:', avg_result)
- Define stubs for the functions get_user_num() and compute_avg(). Each stub should print "FIXME: Finish function_name()" followed by a newline, and should return -1. Each stub must also contain the function's parameters. Sample output with two calls to get_user_num() and one call to compute_avg(): FIXME: Finish get_user_num( ) FIXME: Finish get_user_num() FIXME: Finish compute_avg() Avg: -1 Learn how our autograder works 461710.3116374.qx3zqy7 1234 3 111 Your solution goes here ** 4 user_num1 = 0 5 user_num2 = 0 6 avg_result = 0 7 8 user_num1 = get_user_num() 9 user_num2 = get_user_num() 10 avg_result = compute_avg(user_num1, user_num2) 11 12 print (f'Avg: {avg_result}')3. Write down the results for each of the the following function applications; if any of them is erroneous, indicate what the problem is: 4) ] а. CAR[ (( () b. CDR[ (() 4) ] c. CONS[ (a), (b) ] d. NULL[ CDR[ (a) ] ] Note: NULL [] is a primitive function that returns T if its argument is NIL and otherwise returns NIL It is, effectively, the same as null?[] of Scheme.Write a function that solve the problem and display the answer. You can test your function with the test cases - Q1. Write sq(x) The function sq{x) should accept a numeric argument named x. Then, sq should return the suqare of its argument. For example: In [1]: sq(2) out (1]: 4 In [2): sg(5) Out[2]: 25
- Consider the following function. What is the purpose of the function f? Please do explain and describe in details all possible answers for this function given below.int f(int n) {if ((a >= b) && (c < b)) return b; else if (a >= b) return f(a, c, b); else return f(b, a, c);} To find the maximum number between a, b, and c. To find the middle number between a, b, and c. To find the minimum number between a, b, and c. None of the other statements.Consider the following function. What is the purpose of the function f? Please do explain and describe in details all possible answers for this function given below.int f(int n) {if ((a >= b) && (c < b)) return b; else if (a >= b) return f(a, c, b); else return f(b, a, c);} To find the maximum number between a, b, and c. To find the middle number between a, b, and c. To find the minimum number between a, b, and c. None of the other statements. Suppose the letters a,b,c,d,e,f have probabilities of 1/2, 1/4, 1/8, 1/16, 1/32, 1/32 respectively. Which of the following is the Huffman code for the letter a,b,c,d,e,f? Please show how is the Huffman tree, so that you can determine one of the options below. 0, 10, 110, 1110, 11110, 11111 11, 10, 01, 001, 0001, 0000 11, 10, 011, 010, 001, 000 110, 100, 010, 000, 001, 111 An adjacency matrix of a graph is given below:First, draw the graph defined by that adjacency matrix, and label the vertices of the graph with 1, 2,…Define stubs for the functions get_user_num() and compute_avg(). Each stub should print "FIXME: Finish function_name)" followed by a newline, and should return -1. Each stub must also contain the function's parameters. Sample output with two calls to get_user_num() and one call to compute_avg(): FIXME: Finish get_user_num() | FIXME: Finish get_user_num() FIXME: Finish compute_avg() Avg: -1 354684.2266598.qx3zgy7 2 Your solution goes here ''' 4 user_num1 5 user_num2 6 avg_result get_user_num() get_user_num) compute_avg(user_num1, user_num2) 8 user_num1 9 user_num2 10 avg_result %3D 11 12 print('Avg:', avg_result)
- Part (a) Write a python function that computes the binomial coefficient ("). The function should return the correct answer for any positive integer n and k where k=m pass Part (c) Suppose that the number of people in the trial is 100. Then: • Plot a curve that shows how the probability of type 1 error changes with the choice of m, for m = 1,...n assuming that the null hypothesis holds (in red), • On the same picture, plot the probability of type 2 error vs the value of m in the case in which the new drug is effective with proability 0.68 (in blue). You can plot the two curves using matplotlib.pyplot. You can select the color by passing color='r' or color='b' to the plt.plot() function. [4]: n - 100 # your code here def plot_curve (): pass [5]: plot_curve() Part (d) Based on the picture above, what value of m do you think would be suitable to keep both type 1 and type 2 error small at the same time? (You may assume that the company claims the new drug has 68% accuracy) [6]: # your…Using informal arguments: Write a function polynomial which implements a polynomial function of arbitrary integer order ?: ?(?)=?0+?1?+?2?2+⋯+???? The function should take ? as a formal argument and the constants {??} as informal arguments. You will have to use the *args function argument. The enumerate builtin function will also be convenient in order to get the power ? to go along with each ??. Recall, you can index tuples just like arrays by using [ ]. Test your function by plotting: ?(?)=1+2?2 over the range (-3,3).Write a function that takes 3 integers (num,den,power) as parameters which represent the rational number num/den and its power and returns the difference of these two fractions. (A/B) to the power of n = A to the power of n/B to the power of n • den can not be zero. • use simplify function.