Given Information:
Three different functions are given:
Function-1:
/*clear1 function with a pointer variable and integer as arguments */
void clear1 ( point *p, int n)
{
//variable declaration
int i,j;
//traverse throughout the structure
for(i=0;i<n;i++)
for(j=0;j<3;j++)
//multiply the point with velocity
p[i].vel[j]=0;
for(j=0;j<3;j++)
//multiply the point with acceleration
p[i].acc[j]=0;
}
}
Function-2:
/*clear2 function with a pointer variable and integer as arguments */
void clear2 ( point *p, int n)
{
//variable declaration
int i,j;
//traverse throughout the structure
for(i=0;i<n;i++)
for(j=0;j<3;j++)
//multiply the point with velocity
p[i].vel[j]=0;
//multiply the point with acceleration
p[i].acc[j]=0;
}
Function-3:
/*clear3 function with a pointer variable and integer as arguments */
void clear3 ( point *p, int n)
{
//variable declaration
int i,j;
//traverse throughout the structure
for(j=0;j<3;i++)
for(i=0;i<n;j++)
//multiply the point with velocity
p[i].vel[j]=0;
for(i=0;i<n;j++)
//multiply the point with acceleration
p[i].acc[j]=0;
}
}
Want to see the full answer?
Check out a sample textbook solutionChapter 6 Solutions
Computer Systems: A Programmer's Perspective (3rd Edition)
- (a) Write down the difference local and global variable. Explain with examples.[5]arrow_forwardPRACTICE PROBLEM #1 a) Write pseudo code algorithm for a SIGN(X) function. b) Write Using the SIGN(X) function above, write the pseudo code algorithm that chooses the nearest distance solution from a set of possible solutions for either (prismatic or revolute joints). Assume the joint has a limit dЄ[0,40mm], OE[-4ñ/3, 4ñ/3].arrow_forwardProblem 1. (Markov Model Data Type) Define a data type called xarkovModel in zarkov _zodel.py to represent a Markov model of order k from a given text string. The data type must support the following API: Markovlodel MarkovModel (text, k) constructs a Markov model = of order z from text 2.order () returns the order of = returns the number of occurrences of kgram in = returns the number of times character e follows kgra in = using =, finds and returns a random character following kgraz using =, builds and returns a string of length n, the first x characters of which is zgraz z. kgran freq(kgram) z. char_treq(kgran, c) z.rand (kgraz) z. gen (kgran, n) • Constructor To implement the data type, define two instance variables: an integer k that stores the order of the Markov model, and a symbol table _at whose keys are all the k-grams from the given text. The value corresponding to each key (say kgram) in _at is a symbol table whose keys are the characters that follow kgram in the text, and…arrow_forward
- 7) A bob attached to a cord is moved to the right where its vertical position is 1.05 cm above the equilibrium position and is then given an initial speed of 0.6 m/s. What are the values of the maximum speed and maximum height reached by the bob? (Take g = (a) hmax (b) hmax (c) hmax (d) hmax 9.8 m/s*) 1.87 cm; vmax = 3.44 m/s = 2.89 cm; v. = 0.75 m/s 1.87 cm; vmax = 0.75 m/s = 2.89 cm; v = 3.44 m/sarrow_forwardPROBLEM 21 - 0533: Write a BASIC program to solve Laplace's equation (a²V/Əx?) + (a²V/ay²) = 0. Consider a rectangular 8 by 8 grid %3D with boundary conditions such that 3 sides are assumed to be at a potential of 100. The remaining side is at zero potential as shown. Solution: We use the replacement of partial derivatives by central differencesarrow_forwardrequirement- please answer problem 3 using problem 2 as a referencearrow_forward
- (a) A ssume that five generation unıts with third order cost function (F, (P) = A; P+ B;P+C; P; + D;) are in the circuit. Write a computer program using any arbitrary programming language (MATLAB, C++, C#, Python,.) to calculate economic load dispatch (ELD) using first order gradient method. Note that all parameters and variables should be defined inside the program (at tirst limes) such that units' charactenistics and demand can be changed easily. Neglect grid losses. O using lambda - iteration method.arrow_forward5. (a) Write a function that solves the general linear least-squares problem. The inputs to your function should be a vector of a values, a vector of measured y values, and an anonymous function that calculates a single row of the Z matrix. Inside your function, use the inputted anonymous function to create Z row-by-row, then use Z to create the normal equations. Solve these normal equations to obtain the computed coefficients that define the best-fit of your model. Your function should output these calculated coefficients. Again, include an error check that makes sure the input vectors are the same size. You may not use any built-in MATLAB functions to solve the normal equation. You can use any functions you have developed solves Ax = b via LU-decomposition is one option. e.g. a function you have that (b) Test your function in (a) to fit the following model to the given dataset (see belo y = a + bx (c) Test your function in (a) to fit the following model to the given dataset…arrow_forward(d) In an nonlinear optimisation problem, describe either the penalty function or barrier function method for incorporating constraints into the objective function so that methods for unconstrained optimisation can be used to solve the problem. (20%)arrow_forward
- The coordinates of 4 control points relative to a curve are given by P1(2,2,1) P2(2,3,2) P3(3,3,3) P4(3,2,2) a) write the equation of bezier curve (just write the final result for each coefficient ). b)find coordinates of the curve for t=0, t=0.5 t=1arrow_forward(9) Discrete structure: Please solve it on urgent basis: Question # 9 : In how many ways can a photographer at a wedding arrange6 people in a row from a group of 10 people, wherethe bride and the groom are among these 10 people, if a) the bride must be in the picture? b) both the bride and groom must be in the picture? c) exactly one of the bride and the groom is in the picture?arrow_forward(a) How many ways are usually there for representing a mathematical equation in terms of a C function? Shortly describe each of them. (b) A company has it stokes increasing in a quadratic manner. If each day can be represented by a point on horizontal axis, how would you find a point that shows the day where the stock was at the minimum value. The vertical axis represents the value of the stokes.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education