math

Resources for learning category theory

I am going to take a course on category theory soon. What resources can you recommend for learning about it? What parts are relevant to learn and how do I learn to apply my knowledge? ...

Boost's Linear Algebra Solution for y=Ax

Does boost have one? Where A, y and x is a matrix (sparse and can be very large) and vectors respectively. Either y or x can be unknown. I can't seem to find it here: http://www.boost.org/doc/libs/1_39_0/libs/numeric/ublas/doc/index.htm ...

Haskell Parsing Error

So I have finished creating my own complex number data type in haskell. I've also, thanks to another question on here, got a function that will solve a quadratic equation. The only problem now is that the code generates a parsing error in hugs, when trying to solve a quadratic with complex roots. i.e. In hugs... Main> solve (Q 1 2 1)...

Sine curve on graph - SQL

Hi, Im trying to create a easy sine curv in SQL which alternates between the values (0-23). I have the following variables: x, which is the current offset. y which is the destinated offset, and z which is my max value(23). Anyone that could help me with the expression? Have googled and read about it, but havent got it to work yet.. W...

Rounding a number down in VB

Hi I have a vb application that need to round a number down e.g. 2.556 would become 2.55 and not 2.26 I can do this using a function to strip off the characters more that 2 right from the decimal point using this: Dim TheString As String TheString = 2.556 Dim thelength = Len(TheString) Dim thedecimal = InStr(TheString, ".", CompareM...

Adding two fractions, why a (minor) optimization works..

I was adding a Fraction class to my codebase the other day (the first time, never needed one before and I doubt I do now, but what the hell :-)). When writing the addition between two fractions, I found a small optimization but it doesn't make sense (in the mathematical sense) why it is like it is. To illustrate I will use fractions A a...

Tricky maths problem when resizing images

I have an image that I want to be watermarked to the bottom right section of other images. The dimensions of the watermark image are 179 width, 39 height. Now what if I have another image whose dimensions are 150 width, 20 height? If we tried to watermark it using the original image, it would obviously be too large and the image itself...

Hash function for short strings

I want to send function names from a weak embedded system to the host computer for debugging purpose. Since the two are connected by RS232, which is short on bandwidth, I don't want to send the function's name literally. There are some 15 chars long function names, and I sometimes want to send those names at a pretty high rate. The solu...

How can I generate truly (not pseudo) random numbers with C#?

I know that the Random class can generate pseudo-random numbers but is there a way to generate truly random numbers? ...

math.sin incorrect result

>>> import math >>> math.sin(68) -0.897927680689 sin(68)=0.927(3dp) Any ideas about why I am getting this result? Thanks. ...

Is there a generic way to compute component values like year+month+day from days or miles+yards+feet+inches from inches?

I know there must be a generic method but I don't even know the term to search for and I don't want to re-invent the wheel, badly. 'Separate components values' and 'composite values' don't give good results. another example: degrees+minutes+seconds from seconds of arc, or tons+pounds+ounces from ounces. I'm working in C but it shouldn...

How can I get X amount of files per folder with math?

I actually have it done, I did this math equation about 2 years ago and I am having trouble understanding it now. Basicly I use this so that when users upload photos to my site, I can balance them out with only X amount of photo per folder. This gives me something like this 1/1 1/2 1/3 1/4 ----1/10 2/1 2/2 2/3 and so on but I need ...

Check if a point is in a rotated rectangle (C#)

Hello. I have a program in C# (Windows Forms) which draws some rectangles on a picturebox. They can be drawn at an angle too (rotated). I know each of the rectangles' start point (upper-left corner), their size(width+height) and their angle. Because of the rotation, the start point is not necessarely the upper-left corner, but that does...

Algorithm to generate Poisson and binomial random numbers?

i've been looking around, but i'm not sure how to do it. i've found this page which, in the last paragraph, says: A simple generator for random numbers taken from a Poisson distribution is obtained using this simple recipe: if x1, x2, ... is a sequence of random numbers with uniform distribution between zero and one, k is the first int...

Math needed for software dev jobs

Possible Duplicates: Is mathematics necessary for programming? Do you have to be good at math to be a good programmer? Hello everyone! I am still in my last 2 years of highschool, but I plan to go to a technical school for software development. I want to know what kind of math is required for the job? I have done Algebra, Geom...

A way to get a math answer in fraction form

I'm trying to write a program that will help someone study for the GRE math. As many of you may know, fractions are a big part of the test, and calculators aren't allowed. Basically what I want to do is generate four random numbers (say, 1-50) and either +-/* them and then accept an answer in fraction format. The random number thing is e...

How do I calculate the normal vector of a line segment?

Suppose I have a line segment going from (x1,y1) to (x2,y2). How do I calculate the normal vector perpendicular to the line? I can find lots of stuff about doing this for planes in 3D, but no 2D stuff. Please go easy on the maths (links to worked examples, diagrams or algorithms are welcome), I'm a programmer more than I'm a mathematic...

Finding side length of a cross-section of a pyramid frustum/truncated pyramid

How do I find the side length of a cross-section (as illustrated in the drawing below - cross-section in red) of a pyramid frustum/truncated pyramid? I know the side-lengths of the top and bottom base, the height of the frustum and the distance to the cross-section. Furthermore I know the top and bottom base are parallel and that the ...

Least Squares solution to simultaneous equations

I am trying to fit a transformation from one set of coordinates to another. x' = R + Px + Qy y' = S - Qx + Py Where P,Q,R,S are constants, P = scale*cos(rotation). Q=scale*sin(rotation) There is a well known 'by hand' formula for fitting P,Q,R,S to a set of corresponding points. But I need to have an error estimate on the fit - s...

Inverting binary networks

How can I invert a binary equation, such that I can find which inputs will produce a given output. Example: Inputs: i0 through i8 Outputs: o0 through o8 Operators: ^ = XOR, & = AND Binary equations: (1&i0) ^ (1&i1) ^ (0&i2) ^ (1&i3) ^ (0&i4) ^ (0&i5) ^ (0&i6) ^ (0&i7) ^ (0&i8) = o0 (0&i0) ^ (1&i1) ^ (0&i2) ^ (1&i3) ^ (1&i4) ^ (0&i5)...