473,397 Members | 2,084 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

My determinant code isn't working

i have been trying to get the correct code for a 3x3 matrix and upon checking for information from the net, i realised it was almost like my code..i mean the logic was the same but when i run it, i get a random negative number which is far from the answer.
Below is the code snippet for that portion:
Expand|Select|Wrap|Line Numbers
  1. double determinant =(x[0][0]*x[1][1]*x[2][2]) + (x[0][1]*x[1][2]*x[2][0]) + (x[0][2]*x[1][0]*x[2][1]) - 
  2. (x[0][0]*x[1][2]*x[2][1]) - (x[0][1]*x[1][0]*x[2][2]) -
  3.        (x[0][2]*x[1][1]*x[2][0]);
  4.  
i hope i can get help from here
Oct 11 '10 #1
1 1287
weaknessforcats
9,208 Expert Mod 8TB
Your calculation looks OK but you don't show your matrix.

A random negative value usually means uninitialized variables.
Oct 11 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: jason | last post by:
i am writing some simple web forms with VB.NET as the code-behind language. the code-behind files import a C# class library namespace from a .dll which is in the references list. however,...
9
by: Simon | last post by:
I've got a simple and repetitive bit of code for a function in a C implementation of the card game 31s I'm working on. BTW, I am a bit of a novice at C; for the past couple of years I was using...
10
by: sp | last post by:
The application is written in Visual Basic / .NET and working without problems under Windows XP, Windows 2000, Windows 2003 but it isn't working under Windows ME and Windows 98 - the computer...
0
by: davidr | last post by:
Hi, I have in my behind code a user control with the following in Page Load: this.btn.Attributes.Add("onclick", "SetDivder(" + this.divContainer.ClientID + ");"); In Internet Explorer I...
2
by: PrinceMhul | last post by:
var objListBox = document.getElementById('catalist'); var val = objListBox.value; var txt = dyevalue00.value; document.getElementById(val).value = txt; To explain real quick, this is for a...
31
by: ajos | last post by:
hi frnds, i have a form,which has 2 input text boxes, the values are entering the text boxes,when i leave the 2 text boxes blank and hit submit a java script gives the message that the 2 fields are...
1
by: itgetsharder | last post by:
sorry to post again today, but im trying to figure out why my code isnt doing what i want. Im trying to get the code to add 1 from sheets printed when a print has occured and minus 1 from prints...
7
by: nassausky | last post by:
I acquired a very basic redirect script from: http://www.minisitegallery.com/blog/php-javascript-countdown-script-with-timezone-setting.html which is supposed to count down to a specified date and...
12
by: Hendor | last post by:
Hi all. I've recently set up Apache 2.2 with PHP 5.2 and MySQL 5.1. I played around with SQL a bit, and now I'm trying to access it with PHP. I currently have the code: <?php #...
11
by: wassimdaccache | last post by:
Dear friends I am working on access 2007 sp2. I do have a database(accdb) i converted it to accde. While I am opening the converted database the VBA code is not working. For example...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.