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)
- can you solve this on pythonarrow_forwardProblem No.1 Given: Eight (8) Queens and 8 x 8 chess board Goal: Arrange the 8 Queens in the 8 x 8 chess board as given in the layout above such that only one (1) Queen will be placed in any column, row, and diagonal/s. That is, no two or more Queens are placed in any column, row, and diagonal/s. Solve the problem set by the giving the solution, which is the sequence of steps, that will satisfy the goal. NOTE: The respective Queens are move in their column location only. For example, QA is move along column A, QB column B, and so on. However, you need to give the remaining moves to attain the required goal. Set the column labels from left to right A, B, C, D, E, F, G, and H, respectively. Set the row labels from top to bottom 8, 7, 6, 5, 4, 3, 2, and 1, respectively.arrow_forward2. (3 pts 1.3) Find the domain and range of the function graphed below: Y (a) Domain: 1 x -4 -3 -2 -1 1 2 3 4 5 -2 (b) Range:arrow_forward
- Problem 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_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_forward(6) (a) Use the software for solving linear systems that was introduced in the recitation to solve the linear system, Ax = b, and estimate the condition number of A, where [0.1 0.2 0.3 A= 0.4 0.5 0.6 b = [0.1] 0.3 ' 0.7 0.8 0.9 0.5 (b) What is the estimate of Cond(A)? Based on the size of the condition number, how would you describe the linear system? (c) How many digits of accuracy do you expect the computed solution to have? Justify your answer. Note that this computation is performed using single precision arithmetic.arrow_forward
- PROBLEM 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_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_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
- 5. (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_forwardThe 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_forwardidentify the following problem components: (a) decision variables; (b) parameters; (c) the objective function in words; and (d) constraints in words. Structures. A singly reinforced rectangular concrete beam must carry a known imposed moment and shear. The span length is also known, and the deflection of the beam must not exceed a certain value. The width and depth of the beam are to be determined, as is the area of steel to be placed in the bottom of the beam. The cost of concrete per-cubic-yard and the cost of steel per-pound is known, as is the compressive strength of the concrete and yield strength of the steel. The designer wants to design the least-cost beam. The code for such beams states that a certain minimum amount of steel, as a percent of the tot al effective cross sectional area, must be present in order to avoid excessive cracking on the bottom of the beam due to temperature fluctuations. The code also gives a limit on the maximum amount of steel, again expressed as a…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