In Prolog, define the isUnion predicate so that isUnion(X,Y,Z) says that the union of X and Y is Z. Do not use the predefined list predicates. Your predicate may choose a fixed order for Z. If you query isUnion([1,2],[3],Z) it should find a binding for Z, but it need not succeed on both isUnion([1],[2],[1,2]) and isUnion([1],[2],[2,1]). Your predicate need not work well when X or Y are unbound variables.
isUnion predicate:
isUnion([Head|Tail],Y,Z) :- isMember(Head,Y),
isUnion(Tail,Y,Z).
isUnion([Head|Tail],Y,[X|Z]) :- not(isMember(Head,Y)),
isUnion(Tail,Y,Z).
isUnion([],Y,Y).
isMember predicate:
isMember(X, [X|_]).
isMember(X, [_|Tail]) :- isMember(X,Tail).
In Prolog, define the isUnion predicate so that isUnion(X,Y,Z) says that the union of X and...
PROLOG: Write a prolog predicate that counts occurrences of 'x', 'y', or 'z' in a list. For example, count([x,[y,[a,2],[a,3]],[a,4]], 2) should return true. I only want to count occurrences of x,y,z not a. the base case is that any [a,int] list will have a count of 0. So any sublist with 'a' does not count. another example of what will return true is: count([x,[a,1],[a,5]], 1) The predicate must have the form count(X,Y) where X is the list structure passed and...
Suppose that f :X + Y is a surjection and let yo e Y. Define Z = X -f({yo}) (a) Show that the function g: 2 + Y - {yo}, given by g(x) = f(x) for xe Z, well-defined function. (b) Show that g is a surjection. That denotes
2. Define f : RR by - y 1(x) = { "2+2 (ay) (0,0); (z,y) = (0,0). (i) Isf continuous at (0,0)? Justify your answer. (ii) Show that Daf(3,0) = x for all x and D.f(0,y) = -y for all y (iii) D2f(0,0) + D2,1f(0,0). (iv) Is f differentiable at (0,0)? Justify your answer.
(a) Given constants C, a, 8 € R, define a function by z = f(x, y) = Crºy Let dx/a, dy/y, and dz/z be the approximate relative (percent) changes in x, y, and z, respec- tively. Find the relative (percent) change in z in terms of the relative (percent) changes of a and y. (b) The total production P of a certain product depends on the amount L of labour used and the amount K of capital investment. The Cobb-Douglas...
3 [15 pts Consider the Lorenz system given by xy-B2, z = where σ, ρ, β > 0 are constants. For ρ (0.1), using the Lyapunov function V(x, y, z) = ρ「2 + ơy2 + ơz?, show that the origin is globally asymptotically stable. (Hint. You may need to use the Invariance Principle as well.) στ 3 [15 pts Consider the Lorenz system given by xy-B2, z = where σ, ρ, β > 0 are constants. For ρ (0.1), using...
a. A function f: A B is called injective or one-to-one if whenever f (x) f(u) for some z, y A then y. Which of the following functions are injective? In r-y. That is Vr,y E A f()-f(u) each case explain why or why not i. f:Z Z given by f(z) 3 7 ii. f which maps a QUT student number to the last name of the student with that student number. b. Suppose that we have some finite set...
Define two periodic processes P1 = (3,6,6) and P2 = (2,4,4) where (x,y,z) refers to (compute time, deadline, period). Suppose they have fixed scheduling priorities p1 and p2 respectively. Assume non-preemptive scheduling. (a) Is there a feasible schedule when p1 > p2. Your schedule should cover 18 time units. (b) Repeat using p1 < p2. Assume two periodic processes P1 = (15,30,30) and P2 = (20,50,50). (a) Assume the round robin scheduling policy with one unit time intervals. Show the...
3. For each reagent Q, R, W, X, Y, and Z in the list below, provide one correct function and the two correct reasons for your choice. .. Na O: S: Na Ho KI Na : Q RW > The options are: FUNCTIONS 1 - strong nucleophile + strong base; (choose one) 2 - strong nucleophile + weak base; 3 - weak nucleophile + strong base; 4 - weak nucleophile + weak base REASONS (choose two) A - conjugate acid...
Need optimal solution for x,y, and value Z The Attaran Corporation manufactures two electrical products: portable air conditioners and portable heaters. The assembly process for each is similar in that both require a certain amount of wiring and drilling. Each air conditioner takes 3 hours of wiring and 2 hours of drilling. Each heater must go through 2 hours of wiring and 1 hour of drilling During the next production period, 240 hours of wiring time are available and up...
Part A is wrong and I need help Entered Answer Preview [le^t)/y]+5*cos(5*t)*([-x/(y^2)]+(1/2))+[(6*y/(z^2)]* sin(6*t) 5 +5.2015) (+)+ sino 0.916666666666667 11 12 (1 point) x Suppose w = + where у x = e', y = 2 + sin(5t), and z = 2 + cos(6t). Nie A) Use the chain rule to find was a function of x, y, z, and t. Do not rewrite x, y, and z in terms of t, and do not rewrite e as x. dw dt...