Kennesaw State University CS 4491 Assigment 1


Kennesaw State University
Department of Computer Science
Advanced Topic in Computer Science CS 4491/2
Assignment #1 / Computing with C / Scientific Model


Dalibor Labudovic


01/16/2013


















Initial Problem Statement:
1.)
  1. Elaborate on and expand the concept of multi-dimensional abstraction.
  2. List several arguments that support the concept of multi-dimensional abstraction.
  3. How can multi-dimensional abstraction help in multi- disciplinary computation modeling?
2.) Estimate the height of a building, given the height of a person, h, the distance from the building, D, and the elevation angle, θ, in degrees. Develop a C program to compute the height of a building using the mathematical formula: bh = h + D x tan(θπ/180)
3.) Develop a C program to compute the distance between two points on a circle in the X-Y plane. Use the mathematical expression for computing the distance between two points in the X-Y plane: d =
Summary and purpose of the assignment activity:
The purpose of the assignment is explore the different resources a computer programmer/scientist has at his disposal in order to achieve an objective. Defining the term multi-disciplinary abstraction is a summary of individual skills combined to provide a fundamental and essential principle to solve a problem and software development.
Detail description of the solution and used in the project:
On this assignment, I used shell to write a file dot C program to computerize a mathematical solution to the initial problem presented. Once the program has been written, saved, compiled and tested, the program has presented the desired solution. Variables have been declared and initiated as a double integer. To test the estimate of a building height, the math.h library had been initialed, but the library had to be linked. To link a library to the file.c, script command required to link is as followed: gcc filename –o outputfile –lm.
Table of results:
1.a) To elaborate and expand on the multi-dimensional abstraction, is an individual skill set combined with other individuals to simplify and organize a complex system into a sensible model. A sensible model is a working prototype but it only contains the essentials of the planed/proposed solution.
1.b) The concept of multi-dimension abstraction can be supported with several arguments . Each technical part of a system, such as mathematical computing may require higher level of math, where a mathematician determines and develops a math model and computer scientist translates it into a computer model. A complex system requires input from couple of different fields of science and expertise in order to provide a computing solution.
1.c) A multi-dimensional abstraction process can determine a solution to a computing issue with the help of multidisciplinary computing. With multidisciplinary computing, each individual retains their own methods to the solution without intermixture with other individuals. The advantage of the multidisciplinary computing is the fresh look from each perspective on the same issue. With each discipline, there are advantages and disadvantages but the best part of multidisciplinary computing is the ability to pick and choose best methodologies from each individual and then compile the best system to model a solution.
2) The mathematical formula for estimated height, the solution is straight forward. The solution is easily found with the three known variables.
3) The mathematical formula for distance between two points on a X-Y plane is appropriate for computing, as it is simple mathematical solution. The computing program is useful in situations with two known points.
Discussion of how the system modeled can be improved and extended to include other service:
The system model can be improved with addition of graphics and easy to use with UGI. The simplification and performance could be improved with form and event driven programming.
Comments and Conclusion:
During the assignment, I have learned the importance of other fields input in computing disciplines and finished product. The complexity of a system has to be simplified with a model.
List of References:
Garrido C., Jose. Using Numerical Libraries and C programming for Computing Modeling. CS 4491/02.Web.Science.kennesaw.edu/~jgarrido/CS4491_notes/CS4491_sp13_1_slides.pdf 01/16/2013
Script:
#include <stdio.h>
#include <math.h>
#define PI 3.14159


int main(){
double h;//height
double D;//distance
double a;//angle
double bh;// building height
//user input
printf("\nEnter person height: \n");
scanf("\n%lf", &h);
printf("\nEnter distance form building: \n");
scanf("\n%lf", &D);
printf("\nEnter angle: \n");
scanf("\n%lf", &a);
//calculation
bh = h + D * tan(a*(PI/180));
//print solution
printf("\nThe estimated distance of the building is : %lf", bh);
}
#include <stdio.h>
#include <math.h>
int main(){
double x1, y0, x2, y2, distance;
printf("\nEnter first point: (x,y)\n");
scanf("%lf%lf", &x1, &y0);
printf("\nEnter second point: (x,y)\n");
scanf("%lf%lf", &x2, &y2);
//calculate
distance = ((x2-x1) + (y2-y0));
//print solution
printf("\nDistance between (%lf,%lf) and (%lf,%lf) is : %lf",x1, y0,x2,y2,distance);
}
Script started on Tue 29 Jan 2013 05:44:38 PM EST
[dlabudov@cs3 ~]$ nano distance.c
#(B#)0#[1;28r#[m##[?7h#[?1h#=#[?1h#=#[?1h#=#[H#[J#[0;7m# GNU nano 1.3.12 File: distance.c #[3;1H#[m##include <stdio.h>
#[1B#include <math.h>
#[2Bint main(){
#[1B double x1, y0, x2, y2, distance;#[9;9Hprintf("\nEnter first point: (x,y)\n");#[10;9Hscanf("%lf%lf", &x1, &y0);#[11;9Hprintf("\nEnter second point: (x,y)\n");#[12;9Hscanf("%lf%lf", &x2, &y2);#[14;9H//calculate#[15;9Hdistance = ((x2-x1) + (y2-y0));#[17;9H//print solution#[18;9Hprintf("\nDistance between (%lf,%lf) and (%lf,%lf) is : %lf",x1, y0,x2,y2,distance);
#[1B}#[26;53H#[0;7m#[ Read 17 lines ]
#[1B^G#[m# Get Help#[27;21H#[0;7m#^O#[m# WriteOut#[27;41H#[0;7m#^R#[m# Read File#[27;61H#[0;7m#^Y#[m# Prev Page#[27;81H#[0;7m#^K#[m# Cut Text#[27;101H#[0;7m#^C#[m# Cur Pos
#[1B#[0;7m#^X#[m# Exit#[28;21H#[0;7m#^J#[m# Justify#[28;41H#[0;7m#^W#[m# Where Is#[28;61H#[0;7m#^V#[m# Next Page#[28;81H#[0;7m#^U#[m# UnCut Text#[7C#[0;7m#^T#[m# To Spell
#[25A##[1;112H#[0;7m#Modified
#[2B#[m#include <stdio.h>
#include <stdio.h>
##[23B##[0;7m#Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ? #[27;1H Y#[m# Yes#[K
#[1B#[0;7m# N#[m# No #[28;17H#[0;7m#^C#[m# Cancel#[K#[26;62H
#[0;7m#File Name to Write: distance.c
#[1B^G#[m# Get Help#[27;31H#[0;7m#^T#[m# To Files#[27;61H#[0;7m#M-M#[m# Mac Format#[27;91H#[0;7m#M-P#[m# Prepend
#[1B#[0;7m#^C#[m# Cancel #[0;7m#M-D#[m# DOS Format#[28;61H#[0;7m#M-A#[m# Append#[28;91H#[0;7m#M-B#[m# Backup File#[26;31H
#[1B#[J#[1;112H#[0;7m# #[26;51H#[m##[1K #[0;7m#[ Wrote 17 lines ]#[m##[K#[2B#[51C#[28;1H
#[?1l#>[dlabudov@cs3 ~]$ gcc -Wall distance.c -lm
distance.c: In function ‘main’:
distance.c:17: warning: control reaches end of non-void function
[dlabudov@cs3 ~]$ ./a.out
Enter first point: (x,y)
3
4
Enter second point: (x,y)
7
8
Distance between (3.000000,4.000000) and (7.000000,8.000000) is : 8.000000[dlabudov@cs3 ~]$ nano e##[Kheight.c
#(B#)0#[1;28r#[m##[?7h#[?1h#=#[?1h#=#[?1h#=#[H#[J#[0;7m# GNU nano 1.3.12 File: height.c #[3;1H#[m##include <stdio.h>
#[1B#include <math.h>
#[1B#define PI 3.14159
#[2Bint main(){
#[2B double h;//height#[10;9Hdouble D;//distance#[11;9Hdouble a;//angle#[12;9Hdouble bh;// building height#[14;9H//user input#[15;9Hprintf("\nEnter person height: \n");#[16;9Hscanf("\n%lf", &h);#[17;9Hprintf("\nEnter distance form building: \n");#[18;9Hscanf("\n%lf", &D);#[19;9Hprintf("\nEnter angle: \n");#[20;9Hscanf("\n%lf", &a);#[22;9H//calculation#[23;9Hbh = h + D * tan(a*(PI/180));#[25;9H//print solution#[26;53H#[0;7m#[ Read 25 lines ]
#[1B^G#[m# Get Help#[27;21H#[0;7m#^O#[m# WriteOut#[27;41H#[0;7m#^R#[m# Read File#[27;61H#[0;7m#^Y#[m# Prev Page#[27;81H#[0;7m#^K#[m# Cut Text#[27;101H#[0;7m#^C#[m# Cur Pos
#[1B#[0;7m#^X#[m# Exit#[28;21H#[0;7m#^J#[m# Justify#[28;41H#[0;7m#^W#[m# Where Is#[28;61H#[0;7m#^V#[m# Next Page#[28;81H#[0;7m#^U#[m# UnCut Text#[7C#[0;7m#^T#[m# To Spell
#[25A##[1;112H#[0;7m#Modified
#[2B#[m#include <stdio.h>
#include <stdio.h>
##[23B##[0;7m#Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ? #[27;1H Y#[m# Yes#[K
#[1B#[0;7m# N#[m# No #[28;17H#[0;7m#^C#[m# Cancel#[K#[26;62H
#[0;7m#File Name to Write: height.c
#[1B^G#[m# Get Help#[27;31H#[0;7m#^T#[m# To Files#[27;61H#[0;7m#M-M#[m# Mac Format#[27;91H#[0;7m#M-P#[m# Prepend
#[1B#[0;7m#^C#[m# Cancel #[0;7m#M-D#[m# DOS Format#[28;61H#[0;7m#M-A#[m# Append#[28;91H#[0;7m#M-B#[m# Backup File#[26;29H
#[1B#[J#[1;112H#[0;7m# #[26;51H#[m##[1K #[0;7m#[ Wrote 25 lines ]#[m##[K#[2B#[51C#[28;1H
#[?1l#>[dlabudov@cs3 ~]$ gcc -Wall height.c -lm
height.c: In function ‘main’:
height.c:25: warning: control reaches end of non-void function
[dlabudov@cs3 ~]$ ./a.out
Enter person height:
2
Enter distance form building:
545
Enter angle:
45
The estimated distance of the building is : 546.999277[dlabudov@cs3 ~]$ exit
exit
Script done on Tue 29 Jan 2013 05:45:38 PM EST


Comments

Popular posts from this blog

How to clear & format SD card

Sharepoint List: Days Elapsed or Countdown

CS4500 Test 4 Study Guide