Question

Please I need Visual Basic code with Excel sheet Develop a general VB code that can...

Please I need Visual Basic code with Excel sheet

Develop a general VB code that can compute the determinant of a 3 x 3 matrix (input the matrix values

from cells in the spreadsheet) using the method we discussed in class. Have your program use cofactor

expansion, expanding about the members in the second row (if you want to expand about some other row or column later for your own personal use, that’s fine, but for this program, expand about the second row). Remember to use the (-1)i+j scheme to get the correct signs. Test your program by computing the determinant of a 3 x 3 matrix that you make up. Show the computation of the determinant by hand calculation and compare the answer to the answer you get with your program (i.e., provide a picture or scan of your hand calculation with your homework).

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Option Explicit
Option Base 1
Private Sub CommandButton1_Click()
Dim i As Integer, j As Integer
Dim A(3, 3) As Single, detA As Single
'Input Matrix A
For i = 1 To 3
   For j = 1 To 3
       A(i, j) = Cells(i + 1, j)
   Next j
Next i
'Calculation of matrix determinant
detA = (-1) ^ (2 + 1) * A(2, 1) * (A(1, 2) * A(3, 3) - A(1, 3) * A(3, 2))
detA = detA + (-1) ^ (2 + 2) * A(2, 2) * (A(1, 1) * A(3, 3) - A(1, 3) * A(3, 1))
detA = detA + (-1) ^ (2 + 3) * A(2, 3) * (A(1, 1) * A(3, 2) - A(1, 2) * A(3, 1))
'ouput
Cells(6, 2) = detA
End Sub

Add a comment
Know the answer?
Add Answer to:
Please I need Visual Basic code with Excel sheet Develop a general VB code that can...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • the specific programming language to do this with is Visual Basic what formula? specify what you...

    the specific programming language to do this with is Visual Basic what formula? specify what you mean I want to develop a program which will calculate the total pressure and the hydrostatic pressure on a submerged vehicle in atmospheres. Associate this program with a button on a worksheet. Ask the user to input the specific gravity of the fluid and the submersion depth in feet in an input box. Set a variable for the acceleration of gravity in your code,...

  • Please help me with those 2 question problem, please help, thanks!! Code (Please use visual studio):...

    Please help me with those 2 question problem, please help, thanks!! Code (Please use visual studio): #include <stdio.h> #include <string.h> #pragma warning(disable : 4996) // compiler directive for Visual Studio only // Read before you start: // You are given a partially complete program. Your job is to complete the functions in order for this program to work successfully. // All instructions are given above the required functions, please read them and follow them carefully. // You shoud not modify...

  • PLEASE DO IN C# AND MAKE SURE I CAN COPY CODE INTO VISUAL STUDIO Exercise #2:...

    PLEASE DO IN C# AND MAKE SURE I CAN COPY CODE INTO VISUAL STUDIO Exercise #2: Design and implement a program (name it CompareArrays) that compares the content of 2 single-dimensional arrays of the same size. The program prompts the users to enter the array size. Then prompts the user to initialize each array with integer values. The program defines method Compare() that takes two signal-dimensional arrays of type integer. The method compares the content of the arrays and returns...

  • Problem Statement You are to create a Visual Basic(VB) project for a census bureau to obtain...

    Problem Statement You are to create a Visual Basic(VB) project for a census bureau to obtain and analyze household income survey data within the Pittsburgh   area (including Morgantown Ky). Data Collected: Home identification code (4 alphanumeric characters) – required Program should generate it using a random number generator. You won’t use this anywhere it just need to be generated. Generate the first number in the Form Load event and then each subsequent number in the button click. See attached code...

  • Please write below code in C++ using Visual Studio. Write program that uses a class template...

    Please write below code in C++ using Visual Studio. Write program that uses a class template to create a set of items. The program should: 1. add items to the set (there shouldn't be any duplicates) • Example: if your codes is adding three integers, 10, 5, 10, then your program will add only two values 10 and 5 • Hint: Use vectors and vector functions to store the set of items 2. Get the number of items in the...

  • Please code in C++. link to continue the code is this below or you can make...

    Please code in C++. link to continue the code is this below or you can make your own code if you wish(fix any mistakes if you think there are any in it): cpp.sh/3qcekv 3. Submit a header file (project3.h), a definition file (project3.cpp), a main file (main.cpp), and a makefile to compile them together. Make sure to run the command make and produce an application file and include it with your submission. For this project, you are required to create...

  • can u please on matlab, i have the solution on paper. [30pts] Write a robust, efficient...

    can u please on matlab, i have the solution on paper. [30pts] Write a robust, efficient MATLAB script to find the eigenvalues and eigenvectors of a 2 x2 matrix input by the user. You should test out your script using the following matrices. 1::)-::) 3 2 3 1 B. 1 2 C 2 3 A- D- 4 1 2 4 4 8 -3 8 You may not use any special MATLAB tools. Instead, work symbolically and derive general expressions for...

  • Programming question. Using Visual Studio 2019 C# Windows Form Application (.NET Framework) Please include code for...

    Programming question. Using Visual Studio 2019 C# Windows Form Application (.NET Framework) Please include code for program with ALL conditions met. Conditions to be met: Word Problem A person inherits a large amount of money. The person wants to invest it. He also has to withdraw it annually. How many years will it take him/her to spend all of the investment that earns at a 7% annual interest rate? Note that he/she needs to withdraw $40,000.00 a year. Also there...

  • PLEASE DO IN C# AND MAKE SURE I CAN COPY CODE IN VISUAL STUDIO Exercise #1:...

    PLEASE DO IN C# AND MAKE SURE I CAN COPY CODE IN VISUAL STUDIO Exercise #1: Design and implement class Rectangle to represent a rectangle object. The class defines the following attributes (variables) and methods: 1. Two Class variables of type double named height and width to represent the height and width of the rectangle. Set their default values to 1.0 in the default constructor. 2. A non-argument constructor method to create a default rectangle. 3. Another constructor method to...

  • Homework 06b For...Next Statements The elements of a Hilbert matrix are given by the formula bu=1/(i+j-1),...

    Homework 06b For...Next Statements The elements of a Hilbert matrix are given by the formula bu=1/(i+j-1), where į and j are the row and column indices of the matrix. For example, the 5x5 Hilbert matrix is: [ 1 172 1/3 1/4 175 172 173 174 175 176 173 174 175 176 177 174 175 176 177 178 175 176 177 178 179 Write a Sub that writes the elements of a mxm Hilbert matrix on an Excel spreadsheet, where m...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT