473,387 Members | 1,798 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,387 software developers and data experts.

Complex Calculation

>I'm fairly new to SQL server 2005
database. The client wants to use weighted parameters(5) or areas
of a project, rated from 1-5 on a scale of 1 being the highest, and
the Cost of each project.
i.e. Project A Param1=1, Param2=4 , Param3=1, Param4=2, Param5=5 , Cost= $50000
Using the least squares fit they want to be able to calculate a
projected cost for a project with same weighted parameters.
With this being said I was wondering what I could use to do this using the information from the SQL Server. >Example:
Currently this is a formula used for calculating the least square's fit using a matrixs
Each Row of completed Project Cost for a completed project
ex. Matrix A = 1, u1, v1, w1, x1 Matrix b = M1
1, u2, v2, w2, x2 M2
1, u3, v3, w3, x3 M3
1, un, vn, wn, xn Mn
where u,v,x are weighted parameters where M is a a project
x=(A^T * A)^-1 * (A^T * b) x is the function that defines the least
squares curve for the data set
Mar 31 '08 #1
1 3443
RoRo (Ro***********@gmail.com) writes:
Just let me warn you this is very complex and I'm sorry If I don't
explain enough detail but if anyone could help I would greatly
appreciate it.
This is the Table that is created in my database::

The Insert Statement for the data is very complex b/c I'm getting the
data from radio buttons in my webform...
Writing the INSERT statements for the few rows you posted is not
very complex. Possibly a little tedious.

Anyway, I am not sure how it could have helped.
Just know it works and the information is store like this for a
Metric(Project with the ID of 26).
MetricParameters:::

ParamID MetricID ParamValue Description
4 26 1 rstk
2 26 5 sre6dtk
6 26 1 seu
3 26 2 setj
...
MetricsCost::::
metricID
PrjID
.................................................. ......................
ActualHours(Cost in Hours)

26
15
1589

So with that I need a table that ends up like this:

Project Name Weighed Parameters Actual
Cost
Sys Para Elect ME I&T Cost in Hours
M1 1 1 1 1 500
As I cannot we how you get from the above to this table. I understand
that ParamValue above are weights, but the weights has to be applied
to something.
x = (A^T*A)^ -1 * A^T*b T==transpose -1==inverse matrix
Hm, transposing matrix is not really something you want to do in
SQL. Rows and columns are quite different things.

Maybe you should read the data into client level and work there? (Or
in a CLR stored procedure.)

But I think I have even less understanding of what is going on, so I
may be completely off-base.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Apr 1 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

116
by: Mike MacSween | last post by:
S**t for brains strikes again! Why did I do that? When I met the clients and at some point they vaguely asked whether eventually would it be possible to have some people who could read the data...
8
by: Matt | last post by:
Hi all, Thank you for taking the time. I have a database with 45 tables on it. 44 tables are linked to a main table through a one to one relationship. My question is, is there no way i can...
2
by: cowboyboborton | last post by:
Looking for some help here. I've tried to solve this, but I just can't. What I need to know is what formula to use in an excel calculation to complete the following calculation. It's in two...
2
by: jraul | last post by:
Suppose you have a complex number class, and you overload conversions to double by only taking the real part. You also overload operator* to do complex multiplication. You then write: ...
28
by: beach.dk | last post by:
Hi, I'm trying to implement a simple hash algorith called rs_hash in javascript, but I cannot get a correct result. In c the code looks like this:
5
by: The alMIGHTY N | last post by:
Hi all, Let's say I have a simple math formula: sum (x * y / 1000) / (sum z / 1000) I have to do this across 50 items, each with an x, y and z value, when the page first loads AND when a...
7
by: schaefer.mp | last post by:
To compute the absolute value of a negative base raised to a fractional exponent such as: z = (-3)^4.5 you can compute the real and imaginary parts and then convert to the polar form to get...
9
by: void main | last post by:
I'm rather new to complex numbers in C and was wondering, how do I initialize a complex variable properly if the imaginary part is 0. I tried -------- #include <complex.h> float complex c...
4
by: Reshmi | last post by:
Hi, I have this C code which does complex number arithmetic. When I try to write a similar file for C++, it says that "creal’ was not declared in this scope". Can anyone give a better idea to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.