Download Laboratory works for Assembly language programming. and more Assignments Assembly Language Programming in PDF only on Docsity! I declare that all material in this assignment is my own work except where there is clear reference to the work of others. I have read, understood and agree to the SDSU Policy on Plagiarism and Cheating on the university website at http://go.sdsu.edu/student_affairs/srr/cheating-plagiarism.aspx and the syllabus for the consequences of plagiarism, including both academic and punitive sanctions. ___________________________________________________________________ Remark*. By submitting this assignment report electronically, you are deemed to have signed the declaration above. [Lab Assignment #6, Part 2] [Numerical Analysis Algorithm – Calculate value of Cosine using Taylor Series] COMPE-160 Emrashvili Luka 823355800 EMRASHVILI LUKA 823355800 [LAB ASSIGNMENT #6, PART 2] 1. Description of the Problem / Method: In this programming assignment, we have to create a numerical analysis algorithm. I have chosen computing the value of cosine function using Taylor Series. There are several steps in this program. We had to select, define and test a numerical algorithm using a spreadsheet, write a pseudocode version for the algorithm, implement it as an C code and test the algorithm with a minimum of 50 test cases including extremes and invalid inputs. 2. Pseudocode: FUNCTION Concert to convert radians in the interval [-2 π; 2 π] Input double x; Define result by value of x; IF result is less than -2 π WHILE result is less than -2 π Increase result by 2 π WHILEEND ELSE WHILE result is more than 2 π Decrease result by 2 π WHILEEND Return result FUNCTIONEND FUNCTION Calc_Fact to calculate factorial Input: int x IF x is not equal to 0, FOR iteration bounds [1; x] Multiply result by iterator FOREND EMRASHVILI LUKA 823355800 [LAB ASSIGNMENT #6, PART 2] Certanity = NewTerm; NewTerm = 1.0; k++; } return result; } int main () { double angle, cResult; printf("Enter the angle in radians: "); scanf("%lf", &angle); int j; for (j = 0; j <= 25; ++j){ printf ("The value of cosine of %lf radians in C is %lf\n", angle + j, cos (angle + j)); angle = Convert (angle + j); printf("The value of calculated cosine is %lf\n", cosine(angle)); } return 0; } 4. Screen capture of the code and the resulting display(s): EMRASHVILILUKA 823355800 [LAB ASSIGNMENT #6, PART 2]
Wersineteed todos 11 rox
(0+ 3 0 O kil oir: 3 me
ide
Prater ney
area " Creu ne
eer CTT)
SE Ban ate a a
CET a cosine is 6.753902
sf FET ee
cosine is -@.91113
Pace ore ees aT eee a
coe B Retna co. Saas e
SUS a res RTL art
ro aoe be i i CPL yis
value of cosine of 8.4: Pores
SE Ban for BRE as eee Sg er ee)
[Sst eee Cee ee
a OPryae
Dea ee yes Peet
calculated cosine is -@.848570
eee eet ree
calculated cosine i ES
CSUSB EDEL Coen Creu
Snes SSL eC yates
@ value of cosi pte Pree
}- 258162
or pe
SESS
SER, 7 SOR
Sere
Ras ae i CRE)
a rates
EMRASHVILI LUKA
SENS
Caran)
Nertcs
SENS
Carer
PT
1
an
Sent
SENS
Sent
Sens
value
Sar
a
Tg
calculated cosine i:
f cosine of 19.185850
Sete
ct ae)
alculated cos
ou eet ey sts ts
Ces ma BPE I]
BRT t ey i
ST mY sed
i
Este ase rael)
Bee sac tee ae
371708
Ser eC L) vd
calculated cosine i:
alia > + oD him
823355800
ci
eyes
Coe reuSae
eer ere
fru
CrLraed
Pere)
CREP ery
freuen)
a Aen}
fru
-0.189109
Cre
eae
[LAB ASSIGNMENT #6, PART 2]