Sterling\'s approximation for large factorials is given by n! = squareroot 2 pi
ID: 3789178 • Letter: S
Question
Sterling's approximation for large factorials is given by n! = squareroot 2 pi n (n/e)^n Use the equation to calculate 50!. Compare the results of the value obtained with the MATLAB function factorial by calculating the difference (d) between the two methods: difference d = ________ Input the matrix Q in MATLAB. Q = [12 8 4 3 4 2 5 8 4 6] A = [3 4 8 4 8 5 3 4 8] Write the MATLAB command that you will use to create A from Q. Your command should not be picking the individual elements of >>A = _______ Write a MATLAB command that will delete some of the elements in Q to create the new matrix Q as shown: __________ [12 3 4 2 4 6] What single MATLAB command will you use to create the following matrix. You cannot type in the individual elements. F = [3 4 3 3 4 3 3 4 3]Explanation / Answer
1.
clc;
close all;
clear all;
x=factorial(50)
when we use formula we get 50! = 3.05134e+64
using matlab function we get 50! = 3.04140e+64
so the difference d = 0.00994
2. (i)
mainAQ1.m
clc;
close all;
clear all;
Q=[12 8 4 3 4;2 5 8 4 6]
A=Q(1:2,2:4);
A(3,1:3)=A(1,1:3);
A(1:3,4)=A(1:3,1);
A(1:3,1)=A(1:3,3);
A(1:3,3)=A(1:3,4);
A(:,4)=[]
Output:-
Q =
12 8 4 3 4
2 5 8 4 6
A =
3 4 8
4 8 5
3 4 8
2(ii)
mainAQ2.m
clc;
close all;
clear all;
Q=[12 8 4 3 4;2 5 8 4 6]
A=Q;
A(:,2:3)=[]
Output:-
Q =
12 8 4 3 4
2 5 8 4 6
A =
12 3 4
2 4 6
3.
>> F= [3*ones(3,1) 4*ones(3,1) 3*ones(3,1)]
F =
3 4 3
3 4 3
3 4 3
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.