algebra

floating exception using icc compiler

I'm compiling my code via the following command: icc -ltbb test.cxx -o test Then when I run the program: time ./mp6 100 > output.modified Floating exception 4.871u 0.405s 0:05.28 99.8% 0+0k 0+0io 0pf+0w I get a "Floating exception". This following is code in C++ that I had before the exception and after: // before if (j < E[i]...

Help understanding unipolar transfer function

There is a question I am stuck on using the following formula for the unipolar transfer function: f(net)= 1 __________ -net 1 + e The example has the following: out = 1 ____________ = 0.977 -3.75 1 + e How do we arrive at 0.977? What is e? ...

Is there any algebra calculation library for .NET?

For example, If I give the it a circle and a square, it can tell me how much area they overlaps. ...

Mathematical problem

I have the following function: function getLevel(points) { var level = -1 + Math.sqrt(4 + points/20); // Round down to nearest level return Math.floor(level); } The above function calculates the level of a player based on their points, my problem is that I need a function like this to calculate the points needed for a given lev...

How can I scale multiple windows with fixed aspect ratio so that they cover maximum of monitor without overlapping

My question is in my title. I am trying to develop a logic so that I can scale fixed aspect ratio windows to cover most of the screen without overlapping eachother. There could be two three or four windows. There could be an alignment parameter also. ...

prove, that if sqr(a) + sqr(b) divisible on 7, then a + b divisible on 7 too

how can i prove, that if sqr(a) + sqr(b) divisible on 7, then a + b divisible on 7 too. i'm thinking on it whole day... Thanks update i mean, that sqr(a) = a*a ...

Looking for a bell curve formula to present data that has zero to full affect in a range

a=(0-100) when x=0, a should be 0 when x=100, a should be 100 the data needs to bell curve towards the 100 mark, so that once x passes 100 a will remain at 100 and not go over. Explanation and application follows: We have a number of rows of data that are counted as good, bad or questionable. If a row is bad we count it as full value...

Mixing colors(adding and subtracting colors) like in Art Class!

Hey all, I'm building a color class and I'm looking to add operations more(color, percentage) & less(color, percentage). This requires being able to add and subtract colors and I'm having a hard time with the arithmetic. How do I use RGB or HSB(HSV) or HEX to do operations like: Operation - echo color('blue')->more('yellow', 100%); b...

Fermat's little theorem in JS

Hi, I just tried to implement Fermat's little theorem in JavaScript. I tried it both ways, a^(p-1) mod p = 1 and a^p mod p = a mod p. function fermat(a, p) { return (((a ^ (p - 1)) % p) === 1); } and function fermat(a, p) { return ( ( a^p ) % p ) === ( a % p ); } It doesn't work both ways, is there any way to fix that? ...

Could you grade my relational algebra answers?

I have a Databases exam tomorrow and I have been running over some past papers to check whether my relational algebra knowledge is up to a decent standard or not. If it isn't I'm going to stop working on it now and focus on other possible question types (DDL, Normalization) that may also arise. If it needs just a little bit of work the...

Factorizing a number

I've got a number which is less than 500,000,000 and I want to factorize it in an efficient way. What algorithm do you suggest? Note: I have a time limit of 0.01 sec! I've just written this C++ code but it's absolutely awful! void factorize(int x,vector<doubly> &factors) { for(int i=2;i<=x;i++) { if(x%i==0) { dou...

Find a root of a polynomial modulo 2^r

I have a polynomial P and I would like to find y such that P(y) = 0 modulo 2^r. I have tried something along the lines of Hensel lifting, but I don't know if this could even work, because of the usual condition f'(y mod 2) != 0 mod 2 which is not usually true. Is there a different algorithm available ? Or could a variation of Hensel li...

Greatest GCD between some numbers

Hi, We've got some nonnegative numbers. We want to find the pair with maximum gcd. actually this maximum is more important than the pair! For example if we have: 2 4 5 15 gcd(2,4)=2 gcd(2,5)=1 gcd(2,15)=1 gcd(4,5)=1 gcd(4,15)=1 gcd(5,15)=5 the answer is 5. ...

How to see scaling matrices from a geometric perspective

I'm using XNA but it doesn't matter too much for this example. So let's say I have a sprite. I then apply a scaling matrix before anything. Is the scaling matrix applied scaling the local axis of the sprite or just moving the points down? In other words, is applying a scaling matrix of 0.5f in the world space to my sprite at the world or...

relational algerbra/ sql

what is the equivalent relational algebra operator for not exists (in sql)? That is how do i represent not exists in relational algebra ...

What is a "multisorted algebra", and how do I use it to solve "real problems"?

Apparently, Alexander Stepanov has stated the following in an interview: “I find OOP technically unsound. It attempts to decompose the world in terms of interfaces that vary on a single type. To deal with the real problems you need multisorted algebras - families of interfaces that span multiple types.” [Emphasis added.] Ignoring his s...

solve for x problem

Hi, I'm having trouble solving a simple maths problem. My algebra skills are pretty embaressing. I've programmed a volume slider to give me a decibel gain value. db_gain=(x * (8 / 5)) - 90; For the above I know what x is (the slider thumb position) and I use it to find the db_gain. How can I switch this around so that given the db_g...

Equivalence relational algebra and turing langauge

Hi, I'm starting a project where I want to try to recognize relational algebra's in java-like programming language. For example, given two relations: AmericanActor(Name) EuropianActor(Name) The following expression in RA: AmericanActor U EuropianActor should be equivalent to the following program: void RAMethod(Set<Name> AmericanA...

Can someone please help me with some basic boolean minimization ?

Hey guys, Sorry to be annoying, but I am doing a little bit of work at the moment, and am trying to simplify the following piece of boolean algebra so that I can construct the circuit : A'.B'.C.D + A'.B.C.D' + A'.B.C.D + A.B'.C'.D + A.B'.C.D + A.B.C'.D + A.B.C.D' + A.B.C.D So far I have gotten it to : (C.D) + (B.C) + (A....

How to construct a repeating equation?

Suppose two integers x and N. I'm trying to determine how to construct an algorithm that would return an integer of the value x repeated N times. So if x was 9 and N was 4, the equation would return 9999. And if x was 9 and N was 5, the equation would return 99999. (ad nauseam) I hope this isn't completely absurd or out of place on SO...