Hello all i need help on my next task on Procedural Programming, ive tried to understand many times but i keep getting misled, im a beginner.

Objective
Name: Dot product
Description:
Write a procedure, called dot_product which calculates in the variable ps, the dot(scalar) product of v1 and v2 (v1 and v2 are vectors of IR)
Write an algorithm which determines, for n pairs of given vectors, whether two vectors of given IR are orthogonal, by calling the procedure defined in the previous question. The dot product of two orthogonal vectors is zero.
Modify the previous algorithm if you use a dot_product function instead of a procedure.

Instructions:
Use array for presenting the vector.
Use nested loop (a loop inside another)
Use different types of passing parameters

Answers

Answer 1

Answer:

https://opentextbc.ca/calculusv3openstax/chapter/the-dot-product/

Explanation:

hope its hlp you to understand to find the answer

Answer 2

The `dot_product` is defined as a function, and it returns the dot product value instead of storing it in a variable.

How did we realize this dot product?

Let's break down the task into various steps and work on them one by one.

1. Implementing the dot_product procedure: To calculate the dot product of two vectors, you need to multiply the corresponding elements of the vectors and sum them up. Here's an example implementation of the dot_product procedure in a procedural programming language:

procedure dot_product(v1, v2):

n = length(v1) # Assuming both vectors have the same length

ps = 0 # Initialize the dot product variable to zero

for i = 1 to n:

ps = ps + v1[i] * v2[i] # Multiply corresponding elements and add to the dot product variable

return ps

In this procedure, `v1` and `v2` are the input vectors, and `ps` is the dot product result.

2. Checking if vectors are orthogonal: Now, let's write an algorithm to determine whether two vectors are orthogonal by calling the `dot_product` procedure. We'll use a nested loop to iterate over pairs of vectors.

algorithm check_orthogonal_vectors(vectors):

n = length(vectors) # Number of vector pairs

for i = 1 to n:

v1 = vectors[i][1] # First vector in the pair

v2 = vectors[i][2] # Second vector in the pair

ps = dot_product(v1, v2) # Call the dot_product procedure

if ps == 0:

output "The vectors", v1, "and", v2, "are orthogonal."

else:

output "The vectors", v1, "and", v2, "are not orthogonal."

In this algorithm, `vectors` is an array containing pairs of vectors. Each pair should be a 2D array where the first element represents the first vector and the second element represents the second vector.

Modifying the algorithm using a dot_product function: If you want to use a function instead of a procedure for calculating the dot product, here's how you can modify the previous algorithm:

function dot_product(v1, v2):

n = length(v1) # Assuming both vectors have the same length

ps = 0 # Initialize the dot product variable to zero

for i = 1 to n:

ps = ps + v1[i] * v2[i] # Multiply corresponding elements and add to the dot product variable

return ps

algorithm check_orthogonal_vectors(vectors):

n = length(vectors) # Number of vector pairs

for i = 1 to n:

v1 = vectors[i][1] # First vector in the pair

v2 = vectors[i][2] # Second vector in the pair

ps = dot_product(v1, v2) # Call the dot_product function

if ps == 0:

output "The vectors", v1, "and", v2, "are orthogonal."

else:

output "The vectors", v1, "and", v2, "are not orthogonal."

In this modified version, the `dot_product` is defined as a function, and it returns the dot product value instead of storing it in a variable.

learn more about dot product: https://brainly.com/question/30751487

#SPJ2


Related Questions

Which of the following tools helps ensure your document will open in older versions of word

Answers

Answer:

Compatibility Check

Explanation:

Select File > Info.

In the Inspect Document section, select Check for Issues > Check Compatibility.

Click Select versions to show. A check mark that appears next to the name of the mode that the document is in.

Create a dynamic array of 100 integer values named myNums. Use a pointer variable (like ptr) which points to this array. Use this pointer variable to initialize the myNums array from 2 to 200 and then display the array elements. Delete the dynamic array myNums at the end. You just need to write part of the program.

Answers

Answer:

The required part of the program in C++ is as follows:

int *ptr;

int *myNums = new int(100);

srand (time(NULL));

for (int i = 0; i < 100; i++) {

 myNums[i] = rand() % 200 + 2; }

ptr = myNums;

cout << "Output: ";

for (int i = 0; i < 100; i++) {

 cout <<*(ptr + i) << " "; }

delete[] myNums;

Explanation:

This declares a pointer variable

int *ptr;

This declares the dynamic array myNums

int *myNums = new int(100);

This lets the program generate different random numbers

srand (time(NULL));

This iterates through the array

for (int i = 0; i < 100; i++) {

This generates an integer between 2 and 200 (inclusive) for each array element

 myNums[i] = rand() % 200 + 2; }

This stores the address of first myNums in the pointer

ptr = myNums;

This prints the header "Output"

cout << "Output: ";

This iterates through the pointer

for (int i = 0; i < 100; i++) {

Print each element of the array, followed by space

 cout <<*(ptr + i) << " "; }

This deletes the dynamic array

delete[] myNums;

Consider the following sequence of page references: 1 2 3 3 4 4 1 4 1 3 4. Determine how many page faults will occur with LRU(Least Recently Used) for each of the following algorithms, assuming there are only 2 physical page frames and that both are initially empty.

Answers

Answer:

7 page faults

Explanation:

I have created a small Java program that can be seen in the attached picture below. This Java program uses an LRU algorithm in order to find the number of page faults within an array of page references from the references given in the question. Using these references, and the java program we can see that there are a total of 7 page faults. This can be seen in the output highlighted by red in the picture below.

What is the benefit of using WYSIWYG editor

Answers

A WYSIWYG editor is a program with a rich text editing interface that allows your users to see what the end result will look like (more or less) while they're typing. Without one, users would have to edit raw HTML, which can get in the way of the writing process, to say the least.

Hope it helps! :)

PLEASE HELP ASAP!!

This command allows you to duplicate text from one part of a document while keeping the original text.

Cut
Copy
Format
Paste

Answers

The answer to your question is= Copy

Answer: CTRL + C or copy and paste

Explanation: to copy and paste highlight text by dragging mouse or clicking on touchpad and holding over selected text, if not on a computer but on a touch screen device ( ex: Phone, iPad etc) hold down until it is blue use the tear drops from the top and bottom to highlight the text you need. Then hold down the blue area until options come up stop holding and select copy and then go to where you want to put the text and hold down again and select paste. If on computer drag cursor over text while holding down on left click or holding down on touchpad, it will highlight light blue then left click or click on the touchpad with both fingers and repeat the process of copying and pasting as said before.

Hope this helps! :)

Select the correct answer.
What should you keep in mind when picking a topic for a research paper?
ОА.
choosing a general topic
OB.
choosing a topic that is relatively new
O C.
choosing a specific topic rather than a broad one
OD. choosing a topic based on the most number of sources you can find
Reset
Next

Answers

Answer: The answer is C

Explanation: When it comes to research papers your topic shouldnt be too broad. Your topic should be broad enough you can find a good amount of information but not too focused that you can't find any information.

Consider the efficiency of locating the kth element in a singly-linked list. How does that compare to locating the kth element in a doubly-linked list

Answers

Answer:

Finding kth element is more efficient in a doubly-linked list when compared to a singly-linked list

Explanation:

Assuming that  both lists have firs_t and last_ pointers.

For a singly-linked list ; when locating a kth element, you have iterate through a number of k-1 elements which means that locating an element will be done only in one ( 1 ) direction

For a Doubly-linked list : To locate the Kth element can be done from two ( directions ) i.e. if the Kth element can found either by traversing the number of elements before it or after it . This makes finding the Kth element faster because the shortest route can be taken.

Finding kth element is more efficient in a doubly-linked list when compared to a singly-linked list

write a program that takes as input a number of kilometers and prints the corresponding number of nautical miles.

Answers

Answer:

try this

Explanation:

km = float(input('Kilometers: '))

nm = (km * 5400) / 10000

print('%0.4f km = %0.4f Nautical Miles' %(km,nm))

Write a program that will create an array of random numbers and output the values. Then output the values in the array backwards. SPECIFICATIONS: File name: ArrayBackwards.java Your program must make use of at least one method other than main()to receive full credit (methods can have a return type of void). Suggestion: create and populate the array in the main() method. Make a method for Step 3 below and send in the array as a parameter. Make another method for Step 4 and send in the array as a parameter.

Answers

Answer:

The program is as follows:

import java.util.*;

public class Main{

public static void backward(int [] Rndarray, int lnt){

    System.out.print("Reversed: ");

    for(int itm = lnt-1;itm>=0;itm--){

        System.out.print(Rndarray[itm]+" ");     } }

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

 int lnt = input.nextInt();

 Random rd = new Random();

 int [] Rndarray = new int[lnt];

 for (int itm = 0; itm < lnt; itm++) {

        Rndarray[itm] = rd.nextInt();

        System.out.print(Rndarray[itm]+" ");

     }

     System.out.println();

 backward(Rndarray,lnt); }}

Explanation:

This defines the backward() method

public static void backward(int [] Rndarray, int lnt){

This prints string "Reversed"

    System.out.print("Reversed: ");

This iterates through the array

    for(int itm = lnt-1;itm>=0;itm--){

Each element is then printed, backwards

        System.out.print(Rndarray[itm]+" ");     } }

The main begins here

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

This gets the array length

int  n = input.nextInt();

This creates a Random object

Random rd = new Random();

This declares the array

 int [] Rndarray = new int[lnt];

This iterates through the array for input

 for (int itm = 0; itm < lnt; itm++) {

This generates a random number for each array element

        Rndarray[itm] = rd.nextInt();

This prints the generates number

        System.out.print(Rndarray[itm]+" ");

     }

This prints a new line

     System.out.println();

This passes the array and the length to backward() method

 backward(Rndarray,lnt); }}

Create a class called Circle, which has (i) an attribute radius, (ii) a method that returns the current radius of a circle object, (iii) a method that allows the user to reset the radius of a circle, (iv) a method that calculates the area of the circle, and (v) a constructor that takes a number as parameter input and assign the number as the initial value of radius.

Answers

Answer:

Explanation:

The following class is written in Java. I created the entire Circle class with each of the methods and constructor as requested. I also created a tester class to create a circle object and call some of the methods. The output can be seen in the attached picture below for the tester class.

class Circle {

   double radius;

   public Circle(double radius) {

       this.radius = radius;

   }

   public double getRadius() {

       return radius;

   }

   public void resetRadius() {

       radius = 0;

   }

   public double calculateArea() {

       double square = Math.pow((Math.PI * radius), 2);

       return square;

   }

}

What are the objects in object-oriented programming language?

Answers

Answer:

An object is an abstract data type with the addition of polymorphism and inheritance. Rather than structure programs as code and data, an object-oriented system integrates the two using the concept of an "object". An object has state (data) and behavior (code). Objects can correspond to things found in the real world.

hope it helps ya mate.

You are writing a device driver for an audio device connected to your computer. Your code needs to determine if the device is busy or ready to accept a new command. How can the driver determine this

Answers

Answer: hello the options related to your question is missing attached below is the complete question and options

answer : Read the status register ( A )

Explanation:

To determine if the device is busy or ready to accept a new command the line of action is to write a code that will Read the status register. A status register   is a hardware register which contains the information about the processor of the device ( i.e. whether the processor is busy or ready )

If the user enters any operator symbol other than , -, *, or /, then an UnknownOperatorException is thrown and the user is allowed to reenter that line of input. Define the class UnknownOperatorException as a subclass of the Exception class. Your program should also handle NumberFormatException if the user enters non-numeric data for the operand.

Answers

Answer:

Explanation:

The following code is written in Java. It creates the UnknownOperatorException class and catches it if the user enters something other than the valid operators. If so it continues asking the user for a new input. Once a valid operator is entered, it exits the function and prints the operator.

import java.util.Scanner;

class Brainly {

   public static void main(String[] args) {

       char symbol = askForOperand();

       System.out.println("Operand: " + symbol);

   }

   public static char askForOperand() {

       Scanner in = new Scanner(System.in);

       try {

           System.out.println("Enter operator symbol: ");

           char symbol = in.nextLine().charAt(0);

           if ((symbol != '-') && (symbol != '*') && (symbol != '/')) {

               System.out.println(symbol);

               throw new UnknownOperatorException();

           } else {

               return symbol;

           }

       } catch (NumberFormatException | UnknownOperatorException e) {

           System.out.println("Not a valid operand");

           char symbol = askForOperand();

           return symbol;

       }

   }

}

class UnknownOperatorException extends Exception {

   public UnknownOperatorException() {

       System.out.println("Unknown Operator");

   }

}

(2) What are the limitations of portable computer? ​

Answers

Answer:

Most portable computer are not upgradable and they have a lower specification than most desktop systems


Which statement describes Augmented Reality (AR) technology?

Answers

Answer:

Augmented Reality (AR) superimposes images and audio over the real world in real time. It does allow ambient light and does not require headsets all the time.

yan po ang szgot

wala po kasi pagpipilian

HOPE IT HELPS

pls follow ke

Write a function gcd in assembly language, which takes two parameters, calculates and returns the gcd of those two numbers. You do not need to write the whole program. Just write the function part. The function should use the standard Linux registers for parameters and return values. Add additional comments to describe how you are doing the calculation.

Answers

Answer:

Explanation:

The following is written in Java. It creates the function that takes in two int values to calculate the gcd. It includes step by step comments and prints the gcd value to the console.

       public static void calculateGCD(int x, int y) {

           //x and y are the numbers to find the GCF which is needed first

           x = 12;

           y = 8;

           int gcd = 1;

           //loop through from 1 to the smallest of both numbers

           for(int i = 1; i <= x && i <= y; i++)

           {

               //returns true if both conditions are satisfied

               if(x%i==0 && y%i==0)

                   //once we have both values as true we store i as the greatest common denominator

                   gcd = i;

           }

           //prints the gcd

           System.out.printf("GCD of " + x + " and " + y + " is: " + gcd);

       }

Sixteen stations, numbered 1 through 16, are contending for the use of a shared channel by using the adaptive tree walk protocol. If all the stations whose addresses are prime numbers suddenly become ready at once, how many bit slots are needed to resolve the contention

Answers

Answer:

11 bit slot will be needed

Explanation:

The number of prime numbers between 1 through 16

= 2, 3 , 5, 7, 11 and 13

hence we can say 6 stations are to use the shared channel

Given that all the stations are ready simultaneously

The number of bit slots that will be needed to handle the contention will be 11 bits :

slot 1 : 2, 3, 5 , 7, 11 , 13

slot 2 : 2,3, 5, 7

slot 3 : 2, 3

slot 4 : 2 .   slot 5 : 3 .  slot 6 : 5,7.   slot 7 : 5 .   slot 8 : 7.  slot 9: 11,13.  

slot 10 : 11.   slot 11 : 13

Blockchain technology provides what main benefits for the SUber dApp? The ability to link disparate users The ability to connect users with providers The ability to communicate with other smart devices the ability to communicate with other users

Answers

Answer: The ability to communicate with other users

Explanation:

Blockchain technology refers to a structure which help in the storage of transactional records of people in databases, which is referred to as the chain. It is connected in a network by peer-to-peer nodes.

One main benefit of the Blockchain technology for the SUber dApp is that it gives one the ability to communicate with other users.

Which term refers to a cloud-native, streamlined technology for hosting cloud-based applications, where a server runs for short bursts only when needed by an application or service

Answers

Answer:

Serverless computing.

Explanation:

Cloud computing can be defined as a type of computing that requires shared computing resources such as cloud storage (data storage), servers, computer power, and software over the internet rather than local servers and hard drives.

Generally, cloud computing offers individuals and businesses a fast, effective and efficient way of providing services.

Cloud computing comprises of three (3) service models and these are;

1. Platform as a Service (PaaS).

2. Infrastructure as a Service (IaaS).

3. Software as a Service (SaaS).

The three (3) main characteristics of cloud computing are;

I. Measured service: it allows cloud service providers to monitor and measure the level of service used by various clients with respect to subscriptions.

II. Resource pooling: this allows cloud service providers to serve multiple customers or clients with services that are scalable and provisional.

III. Elasticity: this is the ability of the cloud computing service to be flexible and adaptive to the traffic or requests from the end users.

Serverless computing is a term which refers to a cloud-native and streamlined technology that is designed typically for hosting cloud-based applications, in which a server operates for short bursts only when needed by an application or service. Serverless computing is used for the allocation of machine resources on demand.

what is the value of 2020/20×20​

Answers

Answer:.5.05

Explanation:...maths

Answer:

5.05

Explanation:

2020/400= 5.05

HOPE IT HELPED AND GOOD LUCK!!

Powerpoint can use existing documents of
A. Word
B. Excel
C. Access
D. All of the Above

Answers

Your answer is:



Your answer is B

A network consists of 75 workstations and three servers. The workstations are currently connected to the network with 100 Mbps switches, and the servers have 1000 Mbps connections. Describe two network problems that can be solved by replacing the workstations' 100 Mbps switches and NICs with 1000 Mbps switches and NICs. What potential problems can this upgrade cause

Answers

Answer:

A)  i) starvation  ii) flow control

B) Network congestion

Explanation:

A) Network problems that can be addressed / solved

By replacing the workstations 100 Mbps switches with 1000 Mbps switches the problem of

Starvation;  been faced by the servers due to the delay in sending data to be processed by the servers from the workstations will be resolved .

Flow control : The huge difference in the speeds of the workstations and servers causes a network buffer which leads to packet loss therefore when the workstations 100 Mbps switch is replaced with 1000 Mbps switch this network problem will be resolved

b) The potential problem that can be encountered is Network Congestion

i cant tell if tubbo is a bee or a goat
or could he be human in the smp

Answers

Answer:

Tubbo is a goat or ram on the Dream SMP.

Explanation:

Since Jschlatt was his father and he's a ram, Tubbo is a ram.

Answer:

yes, the first person`s answer is correct! On the dsmp, Tubbo is a goat, since is father was one as well. The only place he is a bee is the osmp, or Origins smp. when Tubbo first joined the dsmp, he was known for his obsession with bees, which carried into his reputation entirely.

:]

Which of these is true of blackhat and whitehat hackers?

Answers

Answer:

Like all hackers, black hat hackers usually have extensive knowledge about breaking into computer networks and bypassing security protocols. They are also responsible for writing malware, which is a method used to gain access to these systems.

Explanation:

that's all. c:

Answer:

c is the answer i hope help you

You designed a program to create a username using the first three letters from the first name and the first four letters of the last name. Usernames cannot have spaces. You are testing your program with a user whose name is Jo Wen. What step in the program plan do you need to revisit

Answers

Answer:

See Explanation

Explanation:

The question would be best answered if there are options to select from; since none is provided, I will provide a general explanation.

From the question, we understand that, you are to test for Jo Wen.

Testing your program with this name will crash the program, because Jo has 2 letters (3 letters are required), and Wen has 3 letters (4 letters are required)

So, the step that needs to be revisited is when the username is generated.

Since the person's name cannot be changed and such person will not be prevented from registering on the platform, you need to create a dynamic process that handles names whose lengths are not up to the required length.

Write the recursive method printNumber. The public static method named printNumber takes two parameters. The first parameter is an integer array called nums, and the second is parameter is an even int called index. The return value is an integer that is the product of the even index values in nums whose index is less than or equal to index. Assume that the array nums has length >

Answers

Answer:

The function is as follows:

public static void printNumber(int nums[],int index){

if (index < 0) {

 System.out.print(nums[0]);

 return;  }

if (index % 2 == 0){

    if(index!=0){

 nums[index-2]*=nums[index];}  }

printNumber(nums, index - 1);

}

Explanation:

To do this, we need to save the required product in the 0 index element of the array.

This defines the function

public static void printNumber(int nums[],int index){

If the index variable < 0,

if (index < 0) {

Print the 0 index as the product [i.e. the calculated product]

 System.out.print(nums[0]);

This ends the recursion

 return;  }

If the current array index is even

if (index % 2 == 0){

Check if index is not 0

    if(index!=0){

If both conditions are valid, calculate the product and save the result in index - 2 element. The final result is then saved in the 0 index

 nums[index-2]*=nums[index];}  }

Call the function while the base case has not been executed

printNumber(nums, index - 1);

}

difference between a lesson plan and scheme of work​

Answers

SORRY BUT THERE IS No difference at all

It is about that list of topics to be taught and learned for a specific period or programme, while scheme of work is drawn from the syllabus and broken into pieces to be taken on a termly basis. The lesson plan is a further breaking down of work to be done. ... Yet teachers are the key to effective learning

8. (a) Write the following statements in ASCII
A = 4.5 x B
X = 75/Y

Answers

Answer:

Explanation:

A=4.5*B

65=4.5*66

65=297

1000001=11011001

10000011=110110011(after adding even parity bit)

X=75/Y

89=75/90

10011001=1001011/1011010

100110011=10010111/10110101(after adding even parity bit)

A computer can manipulate symbols as if it understands the symbols and is reasoning with them, but in fact it is just following cut-and-paste rules without understanding why. This means that:

Answers

Answer:

The symbols may or may not have meaning, but the machine does not need to know how the symbols are interpreted in order to manipulate the symbols in the right way.

Explanation:

The computer can change the symbols in the case when the computer understand but in actual following the cut-paste rules without having any understanding this is because the symbols might be have meaning or not but if we talk about the machine so actually they dont know how the symbols are interpreted and how it can be used so that it can be change in the accurate way

Write a MY SQL query to display the name and hire date of all employees who were hired in 1992.

Answers

Answer:

Select * from Employees where LastName LIKE '%H%' or LastName LIKE '%A%' or   LastName LIKE '%Z%' order by Hiredate(or whatever you put for your year name) desc;

Explanation:

Other Questions
Identify and explain three ways that utilized local or regional geography or modified the land to assist with agriculture. A rancher has a rectangular sheep pen that is 3 meters long and 2 meters wide. The rancher plans to increase both the length and the width of the pen by x meters so that the new area of the pen will be 20 square meters? Can someone help me Im supper confused what is the answer I need help Emmett is doing a presentation on Buddy Bolden. What is an essential piece of information that he should include in this presentation?A. Buddy Bolden was a master of the trumpet.B. He made his living playing music in New York City.C. He sold more records than any other artist in the 1920s.D. Buddy Bolden and his band played blues and folk music. Explain why serine proteases do not catalyze hydrolysis if the amino acid at the hydrolysis site is a D-amino acid. Trypsin, for example, cleaves on the CC-side of L-ArgArg and L-LysLys, but not on the CC-side of D-ArgArg and D-LysLys. Is it important to constantly stay connected for you? BRAINLIEST 20 pts! MAke an Intro about Why teens shouldnt play dangerous sports NO LINKS PLEASEEXPLANATION REQUIREDI WILL GIVE BRAINLIESTDONT MINF MY PRO CROPPING. DEFF.ALSO ITS NOT C I a letter to your neighbor explaining in three major symptoms of dengue fever and two ways of preventing the spread of disease The sequence of DNA ACTGGGCGTAAG part of a gene. How many CODONS can be found in the segment Hellllpppppppppppppp 1.On the websites about HIV and Hepatitis B is intravenous (IV) drug use listed as a risk factor forboth diseases? Heyyo can I get your help on a quick question??Read the excerpt from Notes of a Native Son.It had something to do with his blackness, I thinkhe was very blackwith his blackness and his beauty, and with the fact that he knew that he was black but did not know that he was beautiful. He claimed to be proud of his blackness but it had also been the cause of much humiliation and it had fixed bleak boundaries to his life.Which best describes the effect that racial prejudice had on Baldwins father in early 20th-century America?A) Baldwins father viewed himself in terms of limitations as opposed to possibilities.B) Baldwins father viewed himself in terms of possibilities as opposed to limitations.C) Baldwins father viewed himself in terms of pride as opposed to humiliation.D) Baldwins father viewed himself in terms of humiliation as opposed to pride. Cuntas estrofas tiene? una nia llegando al mar 10. Use the data to determine the missing values in the five-number summary.Data Values5, 7, 2, 3, 4, 1, 7, 8, 5, 6, 2, 3, 7, 1, 9, 6, 1, 2, 5, 3, 8, 3, 2, 7, 5, 9minimum: 1Q1:Q2:Q3:maximum: 9 HELP ME ASPA!!!!!Round your answer to the nearest hundredth.AC= Which of the following shots sends the ball high above an opponent and lands near the baseline?lobsky rocketvolleyserve What is the missing Angel Which of the following statements about variations in species or populations is TRUE?A. Variations help species and populations survive.B. All organisms in a population have the same variations.C. Physical variations are the only traits that help species or populations survive.D. Behavior variations are the only traits that help species or populations survive.