Program:
clc;
clear all;
e=0;
n=1000000;
for i=1:n
if(normrnd(1,0.25)<0)
e=e+1;
end
end
fprintf('%d',e);
output:
31
The output changes every time you run the program and depends on the value of random parameters generated using normrnd
5) What is the output of the following program? (5 Marks) e-0 n-1000000; for i-1 to n if (normrnd...
5. What is the output of the below program? (14 marks) def Fungsi (xx): print ("x is ", xx) values=[8 ,2 , 6 , 6 ,2 ,6) c=0 for i in range (len (values)): if (values[i] == xx): C=C+1 if c> 0 : print ("Return ", c) return c else: C = 100 print ("Return ", c) return c A = Fungsi (2) print ("The A is ", A) B= Fungsi (6) + Fungsi (7) print ("The Bis", B)
Is the following program correct? If it is correct, what is the output? If it is incorrect, please correct the code and write down the output of the program. def fac(n): i=0 sum=0 while i<=n: sum*=i return sum def main(): print(fac(5)) main() PYTHON PLEASE
5.i) What will be the output of the script: for i-1:7 for j- 1:i fprintf(%d", j) end fprintf('\n') % start a new line. end 5 (i) For ax2 + bxc 0, the value of x is given by 2a Write a MATLAB function quadrasol () that will have three inputs ( a,b, and c) and two outputs corresponding to the solutions of the equation. It may be more compact if you defined another variable 'd' for the term inside the...
Please explain very carefully!
4. Suppose that x = (x1, r.) is a sample from a N(μ, σ2) distribution where μ E R, σ2 > 0 are unknown. (a) (5 marks) Let μ+σ~p denote the p-th quantile of the N(μ, σ*) distribution. What does this mean? (b) (10 marks) Determine a UMVU estimate of,1+ ơZp and justify your answer.
4. Suppose that x = (x1, r.) is a sample from a N(μ, σ2) distribution where μ E R, σ2 >...
VERSION 0000000 1 Question 14 [2.5 marks] What is the output of the following code fragment? value 0 for i in range (0, 25, 10) : print (value, end-" ") for j in range (0, 10, 5): value + 1 print ('final value', value ) (a) 0 2 4 final value 6 (b) 0 2 4 6 final value 8 (c) 0 3 6 final value 9 (d) 0 3 6 9 final value 12 (e) None of the above.
1-1 postmultiply by . Take inverses of the resulting expression. -A22A21 I 4.13. Show the following if X is N,(. E) with 0. (a) Check that |E= |2 2||E,, - E, 2E . (Note that | can be factored into the product of contributions from the marginal and conditional distributions.) (b) Check that (x- μ ) Σ (x-μ) - [x1- μιΣι2 Σ7. (x2-μ.)]. - μ "Σ1,Σ3(x2 μ)1 x (Σ1-ΣΣΣ1 + (x -μ2), Σ( X2-μ) (Thus, the joint density exponent can...
12. What is the output of this program? Your answer: 1 def main(): 2 print('The numbers are:') 3 for i in range (2,25): 4 isone (i) 5 def isone (number): isOne = True i = 2 while i < number and is one: if number % i == 0: 10 isOne = False 11 i += 1 Lou if isOne == True: 13 print("\t', i) 14 main() 12 13. What is the output of this program? Your answer: for i...
Question 2 (a) Suppose X ∼ N(μ, σ) and Z ∼ N(0, 1). The moment generating function (m.g.f) of X is given by e^ut+1/2t^2σ^2 (i) What is the m.g.f of Z. [2 Marks] (ii) If Y = cZ +d, where c and d are constant, find the m.g.f of Y and hence the distribution of Y. [4 Marks] (b) Suppose a random variable X follows a geometric distribution with pmf p(x) = p(1−p)^(x−1), x = 1, 2, 3, ..., find...
Part D. On executing the below program, what will be the output of the following program if the source file contains a line "This is a sample."? [5 marks] #include <stdio.h> int main() { char ch; int k, n=0; FILE * fs = fopen("source.txt", "r"); while(1) { ch = fgetc(fs); if(ch == EOF) break; else { for(k=0;k<4;k++) fgetc(fs); printf("%c", ch); n += k; } } printf("%d\n", n); fclose(fs); return 0; } ---------------------------------- Any one can explain the question to me...
5.26 Suppose that y is N, (μ, 2), where μ LJ and -σ2ρ for all Thus E(yi-μ for all i, var(yi) 0" for all i, and cov(yoy ij; that is, the y's are equicorrelated. (a) Show that Σ can be written in the form Σ-σ2(I-P)1+a (b) Show that Σ-i(vi-y?/(r2(1-p] is X2(n-1)
5.26 Suppose that y is N, (μ, 2), where μ LJ and -σ2ρ for all Thus E(yi-μ for all i, var(yi) 0" for all i, and cov(yoy ij; that...