How to calculate function points [closed] - theory

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 6 years ago.
Improve this question
This is a question about theoretical computing. I have came through a question like below;
Consider a project with the following functional units :
Number of user inputs = 50
Number of user outputs = 40
Number of user enquiries = 35
Number of user files = 06
Number of external interfaces = 04
Assuming all complexity adjustment factors and weighing factors as average, the function points for the project will be;
The answer is 672. How is this calculated?

1. Typical complexity averages are as follows:
AVERAGE complexity weights = {4, 5, 4, 10, 7} for the 5 complexities respectively.
2. Typical Characteristic weights are as follows:
AVERAGE characteristic weight = 3.
3. Function point = FP = UFP x VAF
UFP = Sum of all the complexities i.e. the 5 parameters provided in the question,
VAF = Value added Factor i.e. 0.65 + (0.01 * TDI),
TDI = Total Degree of Influence of the 14 General System Characteristics.
Thus function points can be calculated as:
= (200 + 200 + 140 + 60 + 28) x (0.65 + (0.01 x (14 x 3))
= 628 x (0.65 + 0.42)
= 628 x (1.07)
= 672
Thus the function points for the project will be 672.
Checkout this article for a detailed walk-through into function-point calculations.

Related

how to correct a mistake from two dimensional matrix using matlab programming [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
Based on data (e.g. gender,age and handedness) of 8 participants of an experiment I am required to store the information in a 2-dimensional matrix using MATLAB Programming and correct a “mistake” by changing the handedness of two participants. Say:
% id, gender, age, handedness
participants = [1 1 21 1;
2 2 25 1;
3 2 19 1;
4 2 23 2;
5 1 23 1].
Can someone help me please?
You're showing a 5x4 matrix:
% id, gender, age, handedness
participants = [1 1 21 1;
2 2 25 1;
3 2 19 1;
4 2 23 2;
5 1 23 1];
In Matlab you can access cells in a matrix with the () operator. In your case your 2D matrix you have (row,column). E.g. the age of the second participant would be
display(participants(2,3)); % 25
You can show all rows or columns with : e.g.
display(participants(2,:)); % 2 2 25 1
will display all information for the second participant whereas
display(participants(:,3)); % 21; 25; 19; 23; 23
will display the third column "age".
If you want to modify a cell you can do it like this:
participants(2,3) = 99
This would change the age of the second participant to 99.
hth
If I understood you correctly, probably what you want to do is to estimate (e.g., with OLS) the handedness as a function of the other two variables and project on the fitted hyperplane, to find the handedness values that gives the largest errors. We can do the same with the following:
X = participants(:,2:3); % explanatory variables or regressors
y = participants(:,4); % the dependent variable handedness
w = inv(X'*X)*(X'*y); % weights learnt for OLS
y_hat = X*w % predicted handness
% 0.97038
% 1.41533
% 1.22988
% 1.35351
% 1.03220
e = abs(y - X*w) % errors in prediction
% 0.029620
% 0.415325
% 0.229878
% 0.646491
% 0.032196
As we can see, the two handedness values with maximum errors (mistakes) are the 2nd and the 4th value, which are respectively 1 and 2 in the sample data. So they are the ones with maximum mistakes and can be corrected.

Simple approximation of Sine [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I'm looking for an approximation for Sine which is correct at x == 0 and x == 90 or x == pi/2 and within 5% otherwise.
I have no space for look-up tables.
You seem to be able to use Bhaskara I's sine approximation formula :
float x;
float sinx = 4 * x * (180 - x) / (40500 - x * (180 - x));
The error stays within 2%.
Very fast and can be optimized (by hand).
Since the derivative of a sin is cos which never goes above 1, and 5% is 1 / 20, a lookup table with 20 * pi / 2 = 32 points would satisfy your requirements. Are you sure you can't spare even 32 bytes of your RAM to store it?
The only way that I can think to do this is to use Taylor/Maclaurin Expansions.
These form a polynomial which represents an ever-improving approximation to a function.
In general you pick a value of the function about which you want to approximate via Taylor series.
For example around x = 0 radians sin(x) = x - x^3 / 3! + x^5 / 5!. The series is infinite and the more terms you include the closer to the true value you will get.
I suggest that you might have to form several of these Taylor expansions at "convenient" places (30, 60, 45, 90 degrees). And then use the function that you angle is closest to.
Found with a quick linear fit.
1.00003 x - 0.000312267 x^2 - 0.165537 x^3 - 0.00203937 x^4 + 0.010286 x^5 - 0.000961693 x^6
This maximum error is 3%.

Algorithm | Given an array[] and k, find number of subsets sum multiple of k [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Given an array[] of positive integers and another integer k, I have to find number of subset whose sum is multiple of k(sum is evenly divisible by k).
For example,
array[] = {1, 2, 3, 4}, k = 3
Subset sums are,
1 = 1
1 + 2 = 3
1 + 2 + 3 = 6
1 + 2 + 3 + 4 = 10
2 = 2
2 + 3 = 5
2 + 3 + 4 = 9
3 = 3
3 + 4 = 7
4 = 4
Thus, {3, 6, 9} are multiple of k = 3 and the answer is 3. For the same array above and k = 2, answer will be 4 = {6, 10, 2, 4}
How to implement it efficiently for array size 1 million.
This is a close variant of Subset Sum Problem, and as the original, it is NP-Complete (Reduction from Partition Problem is trivial).
It can be solved using Dynamic Programming by following the recursive formulas:
D(0,0) = true
D(0,x) = false x > 0
D(i,x) = false x < 0
D(i,x) = D(i-1,x) OR D(i-1,x-arr[i])
In here, D(i,x) is true if and only if you can use a subset of the first i elements to build the number x.
This can be calculated efficiently using Dynamic Programming.
When you are done, simply count the number of values of i such that D(n,k*i) = true
This will take O(n*W) time where n is the number of elements, and W is the sum of them.
This seems like a clear use of using recursion.
for each value in array
test value by itself
test all combinations of remaining array, both with value added and without value added.

Sum array diagonally with Inverted location [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
How to sum an array the array maybe will be 10x10 or 2x2 or 3x3
1 2 3
1 2 3
1 2 3
i want to sum the Inverted digonal start from [1,3] end [3,1] but we want to consider that the length of the array could change.
Something like this should do it (Assuming your Array is called x):
Dim Sum As Double = 0
For i = 0 To UBound(x, 2)
Sum += x(UBound(x, 2) - i, i)
Next
Assuming that your array will always be square (i.e. 2x2, 6x6, 200x200, etc) then the following pseudo-code will produce the result you are after:
x = [square array]
i = 0
j = x.length - 1
sum = 0
while (i < x.length)
sum += x[j--][i++]

Finding Factorials and Ending zeros of a Factorial Number [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have a problem. I want to find factorial of big numbers.
Ex: 1555! = ?.
195! = ?.
My main problem is that I want to know the exact number of ending 0's of the factorial numbers.
I use the following formula:
(m!)^n = m! = 2*10^(n-1) + 2^2 * 10^(n-2) + ------- + 2^n.
with this I can solve the other factorials for number of ending 0's like this.
100!= 2*10^1 + 2^2*10^0 = 20+4 = 24
100! has 24 ending 0's as per this calculation.
But, then I got other problem,
Ex: For 95!
i) 95! = (100 - 5)! = 24 - 2*5^(1-1) = 24 - 2 = 22 => 95! has 22 0's.
ii) 95! = (90 + 5)! = 9*(2*10^0) + 2*5^0)= 18+2 = 20 => 95! has 20 0's.
this is my problem. By using the above formula I got two different answers and I am confused, I don't get the perfect answer so please help me to find it.
Thank you...
The number of trailing zeros in n! is the number of factors of 5 in the sequence 1, 2, ..., n. This is because a trailing zeros is the number of factors of 10 in the result, and 10 has a prime factorisation of 5 x 2. There's always more factors of 2 than 5, so the number of 5's gives the result.
The number of factors of 5 is... [n/5] + [n/25] + ... + [n/(5^k)] + ... where [ ] means round down (floor).
What should the code look like to compute this? Something like this perhaps.
int trailing_factorial_zeros(int n) {
int result = 0;
int m5 = 5;
while (n >= m5) {
result += n / m5;
m5 *= 5;
}
return result;
}
This is a bad question, probably belongs on Math site anyway. But here's a thought for you:
First 100! = 100 * 99!
99! = 99 * 98! and so forth until
1! = 1, and 0! = 1.
You want to know how many trailing 0's are in N! (at least that is how I understand the question).
Think of how many are in 10!
10! = 3628800
so there are two. The reason why is because only 2*5 = a number with a trailing 0 along with 10. So we have a total of 2. (5*4 has a trailing 0 but 4 is a multiple of 2, and besides, we only get to multiply individual numbers once)
It is a good bet, then, that 20! has 4 (it does).
It's now your job to prove (or disprove) that this pattern will hold, and then come up with a way to code it.

Resources