Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Writing a C program. 2 Vector Calculations We wish to write a set of C functions to work with 3-D vectors. Write C functions as

Writing a C program.

image text in transcribedimage text in transcribed

2 Vector Calculations We wish to write a set of C functions to work with 3-D vectors. Write C functions as follows: . VectorMagnitude -Input: An array that represents a 3-D vector p (K,V,,VJ -Output: The magnitude of the input vector V- /V 4 V 4 V 2 . DotProduct Input: Two arrays of three elements each. that represent vectors Vi and -Output!: The dot product of these two vectors Vi . -Vo * V,2 + Vy1 *Wa + V, * V,2 -Output2: The angle between the two vectors (in degrees) -cos-1 (150). Note that this calculation must call the function Vec torMagnitude twice. . CrossProduct - Input: Two arrays of three elements cach, that represent vectors V and V2 Output: A 3-element array that represents the cross product of the two input vectors. The cross product is described below - Output2: The angle between the two input vectors (in degrees). The method for calculating the angle between the two input vectors, using the cross product is described below The cross product of two vectors is defined as the formal determinant of the following matrix The cross product can be used to find the angle between two vectors 180 = sin where h -Note that this calculation requires three calls to VectorMagnitude. Also note that the value inside the parenthesis of the sin fnction might need limiting between +1 HINT: Your functions will have to pass arrays back and forth. A pointer argument may also be necessary for the angle between the two vectors. Write a C program that prompts the user to choose between the following options . M for vector magnitude. This option prompts the user to enter in a single 3-D vector D for dot product. This option prompts the user to enter in two 3-D vectors. . C for cross product. This option prompts the user to enter in two 3-D vectors. Print the output of the appropriate calculations to the screen

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Managing Your Information How To Design And Create A Textual Database On Your Microcomputer

Authors: Tenopir, Carol, Lundeen, Gerald

1st Edition

1555700233, 9781555700232

More Books

Students also viewed these Databases questions

Question

What are the differences between an explicit and an implicit tax?

Answered: 1 week ago