THE CORRECT OPTION IS:
(D) powerof2(K, P) :- K1 is K-1, powerof2(K1, P1), P is P1*2.
because it recursively does K-1 till it's 0 and then multiplies the base value by twice K times to check if it is P or not. If yes then returns true else false.
Select the correct PROLOG definition of powerof2/2, where powerof2(K,N) checks whether N is equal to 2K...
Incorrect Question 19 0/5 pts Select the correct PROLOG definition of length/2, where length(L.N) checks whether N is the length (number of elements) of the list L. (A) (B) length([10). length([H|Tail),N) :- length(Tail,Ni), N is 1+ N1. length([1,0). length([H|Tail],N) :- length(Tail,N1), N is 1 + N1. length([1,0). length([H|Tail],N) :- Nis 1 + N1, length(Tail,N1). length((1,0). length([H]Tail),N) :- length(Tail,Ni), N-1 + N1. (C) (D) (A) (B) (C) (D)
Recall that for the Harmonic oscillator: vmk h Where k 2/2 is the wavenumber and m is the particle mass. =n2R-2k (n-2k)!k HT ka-2k where a integers; the coresponding wavefuction is Where k and |n are = The first three solutions (lecture 3) for the quantum harmonic oscillator are: n 0,k 0 Ho(1 = hwo/2 = ' Eo 25 E, — Зho/2 Н. (€) n 1, k n 2, k 0,1 E2 5hao/2 H2(42 2, Plot for a 1 ev...
(b) Define the PROLOG predicate poweroftwo(K,P) 2 where K is a natural number to calculate P Example: poweroftwo (5,P)
2. A linear system S has the relationship y[n] = į f[k]g[n – 2k] k=-- between its input f[n] and its output y[n], where g[n] = u[n] - u[n – 4). (a) Determine y[n] when f[n] = 8[n – 1]. (b) Determine y[n] when f[n] = 8[n – 2]. (c) Is S LTI? Justify your answer. (d) Determine y[n] when f[n] = u[n].
Incorrect Question 17 0/5 pts Complete the second rule of the following PROLOG program for last/2 where last(X,L) checks whether X is the last element of the list L. last(X,[X]). last(X,[LIT]):- (A) last([). (B) last(X,_). (C) last(X,T). (D) None of these (A) (B) (C) (D)
Use the Ratio Test to determine whether the series converges ab 00 2k Σ k 149 k= 1 Select the correct choice below and fill in the answer box to compl (Type an exact answer in simplified form.) O A. The series converges absolutely because r = OB. The series diverges because r= O c. The Ratio Test is inconclusive because r=
Determine whether the following series converges. 0 Σ 8(-1) 2k + 5 k=0 Let ak 20 represent the magnitude of the terms of the given series. Select the correct choice below and fill in the answer box(es) to complete your choice. A. The series converges because ak = of k>N for which ak+1 Sak: and for any index N, there are some values of k>N for which ak+1 ? ak and some values B. The series converges because ak =...
Relation Exercise 4. Determine i the folloung are order relations on X = N, and or those that are, designate u hich is a total ordering or a partial ordering. (a) mk ENo, k 0 with n-m +k (b) m-n- k E No, k > 0 with n-m+2k. (c) mnkeN, k20 with mk m-21, n22, k1, k2 E No, t1, l2 EN are odd;1 If11-1, 12-1, and k1 < k2 OR This is called the Sharkovskii ordering, and will feature...
2. Exercise 2. Consider the sequence (xn)n≥1 defined by xn = Xn k=1 cos(k) k + n2 = cos(1) 1 + n2 + cos(2) 2 + n2 + · · · + cos(n) n + n2 . (a) Use the triangle inequality to prove that |xn| ≤ n 1 + n2 for all n ≥ 1. (b) Use (a) and the -definition of limit to show that limn→∞ xn = 0. Exercise 2. Consider the sequence (In)n> defined by cos(k)...
Consider the equation PT = kVN, where k is a constant. Select all of the correct answers that describe the variation between variables. Nvaries inversely with V Tvaries inversely with V p varies inversely with T Tvaries directly with N Op varies directly with V Dp varies inversely with N