text
stringlengths
0
27.6k
python
int64
0
1
DeepLearning or NLP
int64
0
1
Other
int64
0
1
Machine Learning
int64
0
1
Mathematics
int64
0
1
Trash
int64
0
1
I have a standalone Java application below that is: Generating a random line Applied to a 2D grid where each cell value is the distance along the line perpindicular to the line Finds the rise/run and attempts to calculate the original linear equation from the grid Applies new line to another grid and prints out the gr...
0
0
0
0
1
0
I'm currently in the throes of writing a system based on subdividing space (it's for a game), I need to be able to test if a circle completely contains a square. For bonus points, I should point out that my system works in N dimensions, so if your algorithm works by looping through each dimension and doing something, p...
0
0
0
0
1
0
Problem: How many of the first 100,000,000 hexagonal numbers are divisible by all the numbers from 1 through 20? 2nd solution - simple brute force (does work) public static void main(String[] args) { long hnr = 100000000L, count = 0L; for (long i = 1, h = getHexNr(i); i <= hnr; i++, h = getHexNr(i)) if (h % 2...
0
0
0
0
1
0
I am working in a natural language processing project. It aims to build libraries for Arabic language. We working on a POS tagger and now I am thinking in grammar phase. Since Arabic language and many others have complicated grammar, so it is very hard to build their context free grammar (CFG). For this reason I had an...
0
1
0
0
0
0
I have five values, A, B, C, D and E. Given the constraint A + B + C + D + E = 1, and five functions F(A), F(B), F(C), F(D), F(E), I need to solve for A through E such that F(A) = F(B) = F(C) = F(D) = F(E). What's the best algorithm/approach to use for this? I don't care if I have to write it myself, I would just like...
0
0
0
0
1
0
I have this complex iterations program I wrote in TI Basic to perform a basic iteration on a complex number and then give the magnitude of the result: INPUT “SEED?”, C INPUT “ITERATIONS?”, N C→Z For (I,1,N) Z^2 + C → Z DISP Z DISP “MAGNITUDE”, sqrt ((real(Z)^2 + imag(Z)^2)) PAUSE END What I would like to do is make a ...
0
0
0
0
1
0
Suppose we have two longs, x and y. What operator or function involving x and y would produce another long, z, which is least likely to be equal to the result of applying the same operator or function to different of x's and y's? Ex: Addition would be a poor choice. 1+4=5, but 2+3 also equals 5. EDIT: Let me explain wh...
0
0
0
0
1
0
If I have a camera which gives out 360 degree pan (x) and tilt (y) values, and I want to get the pan and tilt values of where I have my cursor in the camera's view, how would I convert that? More info: It's a Flash/AS3 project. The pan and tilt values are from the center of the camera view. Camera view size is 960x540....
0
0
0
0
1
0
I'm using some fairly straight-forward SQL code to calculate the coefficients of regression (intercept and slope) of some (x,y) data points, using least-squares. This gives me a nice best-fit line through the data. However we would like to be able to see the 95% and 5% confidence intervals for the line of best-fit (the...
0
0
0
0
1
0
In our discrete mathematics course in my university, the teacher shows his students the Ackermann function and assign the student to develop the function on paper. Beside being a benchmark for recursion optimisation, does the Ackermann function has any real uses ?
0
0
0
0
1
0
If M is prime, how to choose a and b to minimize collisions? Also in books it is written that to find the empty slot while quadratic probing in (f(k)+j^2) % M, the hash table has to be at least half empty? Can someone provide me a proof of that?
0
0
0
0
1
0
I have a bunch of vectors normal to window surfaces in a 3D modelling software. Projected to the XY-Plane, I would like to know in which direction they are facing, translated to the 8 compass coordinates (North, North-East, East, South-East, South, South-West, West and North-West). The vectors work like this: the X ax...
0
0
0
0
1
0
Is there a simple way to do this if (1 < x && x < 3) { .... } I want something like this: if (1 < x < 3) { .... } I know that the code above is wrong but.... Thanks
0
0
0
0
1
0
I wrote a drawing function that draws various on-screen sprites. These sprites can only overlap up to a point. If they have to much overlap, they become too obscured. As a result I need to detect when these sprites are too much overlapped. Luckily, the problem is simplified in that the sprites can be treated as orthogo...
0
0
0
0
1
0
my primary language is spanish, but I use all my software in english, including windows; however I'd like to use speech recognition in spanish. Do you know if there's a way to use vista's speech recognition in other language than the primary os language?
0
1
0
0
0
0
Is there a way to find potential numeric overflows in Java code, using the Eclipse IDE? For example... long aLong = X * Y * Z; ... where X, Y, and Z are ints and the result may overflow Integer.MAX_VALUE. (Note that, perhaps counter-intuitively, if the result in this example overflows Integer.MAX_VALUE, aLong will be ...
0
0
0
0
1
0
I am currently writing a bot for a MMORPG. Though, currently I am stuck at trying to figure out how to nicely implement this. The design problem is related to casting the character spells in the correct order. Here is a simple example to what I need to archieve. It's not related to casting them, but doing it in the cor...
0
1
0
0
0
0
Those who have worked or working in artificial intelligence(or equivalent) area should be knowing the AO* algorithm very well. Its pretty clear that it is a generalized algorithm. Do anybody of you have come across any practical application of the AO* algorithm?Some of you might already have worked on it. So it would b...
0
1
0
0
0
0
Currently, generics in C# do not allow any sane way to perform arithmetic. There are awkward workarounds available, but none of them are very neat and all of them reduce performance. According to this interview, an interface with arithmetic types is not possible to implement, and so one such workaround is suggested. B...
0
0
0
0
1
0
I'm trying to better understand what exactly this code is doing. It's written in Objective-C, but should be familiar to anyone with a C background. What exactly are sin/cos mathematics doing here? Also, does anyone have a good recommendation for learning trig for gaming concepts such as these? for (int i = 0; i < GAME_...
0
0
0
0
1
0
Why this code 7.30 - 7.20 in ruby returns 0.0999999999999996, not 0.10? But if i'll write 7.30 - 7.16, for example, everything will be ok, i'll get 0.14. What the problem, and how can i solve it?
0
0
0
0
1
0
I'm trying to make a flashing object, i.e., increment it's alpha value from 0 to 255 (gradually) and then back down to 0, and repeat. Is there a way I can do this without using some boolean? Getting it to increment is easy: alpha = time.elapsed()%256; But what's a nice way to get it to count back down again after that...
0
0
0
0
1
0
I'm trying to figure out a way to algorithmically get the amplitude and phase of a function that has sinusoidal terms in the Maxima computer algebra system. This only applies to steady state (as t -> infinity and the transients decay). For example, a trivial case would be: f(t) = 1 / w * sin(w * t + theta) + exp(-a *...
0
0
0
0
1
0
If I have a set of values (which I'll call x), and a number of subsets of x: What is the best way to work out all possible combinations of subsets whose union is equal to x, but none of whom intersect with each other. An example might be: if x is the set of the numbers 1 to 100, and I have four subsets: a = 0-49 b = 5...
0
0
0
0
1
0
I am working on a project (C# and .NET Framework) which requires me to solve some partial differential equations. Are there any specific libraries based on .NET Framework that I could see and make my work simpler? I have worked with MATLAb and solving partial differential equations is very straightforward there. How ca...
0
0
0
0
1
0
My DotNET application has a limited scripting language build in (modelled loosely on VBScript) mainly for post-processing numbers, points and vectors. I've just added support for complex numbers, but I'm struggling with the notation. I don't want to use the A + Bi notation, since it is not a clear division if A or B ar...
0
0
0
0
1
0
My degree is in Electrical and Computer Engineering but i'm currently employed as a Software Engineer. I took all of the algebra, geometry and calculus classes that one would expect from someone with my degree however I must admit, I think I learned just enough to pass the test but never really saw a use for it and the...
0
0
0
0
1
0
How can I calculate values between 0 and 1 from values between 0 and n. E.g. I have items with "click count" and want to get "importance" (a float between 0 and 1) from that. My attempt: importance = 1-1/count gives bad results, since the values don't distribute well…
0
0
0
0
1
0
I am working on a somewhat large corpus with articles numbering the tens of thousands. I am currently using PDFBox to extract with various success, and I am looking for a way to programatically check each file to see if the extraction was moderately successful or not. I'm currently thinking of running a spellchecker on...
0
1
0
0
0
0
I have the following code using C++: double value = .3; double result = cos(value); When I look at the values in the locals window for "value" it shows 0.2999999999 Then, when I get the value of "result" I get: 0.95533648912560598 However, when I run cos(.3) on the computers calculator I get: .9999862922474 So clearly...
0
0
0
0
1
0
I need to ask someone for a big favor. What you see in the code below are my calculations for train movement for a train game I am writing. There is a problem with the calculations, but I just can't seem to find it. The problem seems to be located in this code: if($trainRow['direction'] == '-') { $trackUn...
0
0
0
0
1
0
I'm looking for an algorithm that would move a point around an arbitrary closed polygon that is not self-crossing in N time. For example, move a point smoothly around a circle in 3 seconds.
0
0
0
0
1
0
var = 8 itr 1: var == 8 (8 * 1) itr 2: var == 24 (8 * 3) itr 3: var == 48 (8 * 6) itr 4: var == 80 (8 * 10) itr 5: var == 120 (8 * 15) Pattern: (var * (last multiplier + current iteration)) Basically I want to get the result of formula(itr) without having to iterate up to itr.
0
0
0
0
1
0
I have a planar element in 3D space that I've rotated on the x, y and z axis. I'm positioning a 3D camera in front of the planar but I need to find a way to calculate the x, y, z of the camera. I'm trying to figure out how to place the camera at x distance from the planes face. There's obviously a bit of trig involved ...
0
0
0
0
1
0
I have a computer program that reads in an array of chars that operands and operators written in postfix notation. The program then scans through the array works out the result by using a stack as shown : get next char in array until there are no more if char is operand push operand into stack if char is operator ...
0
0
0
0
1
0
How you could calculate size of brute force method dynamically? For example how many iterations and space would take if you printed all IPv6 addresses from 0:0:0:0:0:0:0:0 - ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff to file? The tricky parts are those when length of line varies. IP address is only example. Idea is that ...
0
0
0
0
1
0
Let's say I have 20 players [names A .. T] in a tournament. The rules of the tournament state that each player plays every other player twice [A vs B, B vs A, A vs C .. etc]. With 20 players, there will be a total of 380 matches. In each match, there are three possible outcomes - player 1 wins, player 2 wins, or draw. ...
0
1
0
0
0
0
I am writing a test tool which places a large amount of load on a network service. I would like this tool to start with little load and gradually increase over time. I am sure that there is some triganometry which can do this sort of calculation in one line of code but I am not a math guru (yet). Is there some sort of ...
0
0
0
0
1
0
I have a logical statement that says "If everyone plays the game, we will have fun". In formal logic we can write this as: Let D mean the people playing. Let G be the predicate for play the game. Let F be the predicate for having fun. Thus [VxeD, G(x)] -> [VyeD, F(y)] V is the computer science symbol for universal quan...
0
0
0
0
1
0
I am trying to calculate the vertices of a rotated rectangle (2D). It's easy enough if the rectangle has not been rotated, I figured that part out. If the rectangle has been rotated, I thought of two possible ways to calculate the vertices. Figure out how to transform the vertices from local/object/model space (the on...
0
0
0
0
1
0
I am implementing a custo crypto library using the Diffie-Hellman protocol (yes, i know about rsa/ssl/and the likes - i am using it specific purposes) and so far it turned out better than i original expected - using GMP, it's very fast. My question is, besides the obvious key exchange part, if this protocol can be used...
0
0
0
0
1
0
How can I do Mathematica-style a = Table[2^(2 k) + 1, {k, 1, 3}] Last[a], First[a] Append[a,3] in Octave?
0
0
0
0
1
0
I have a C# method and which accepts three string parameters. After converting them to decimal, I am trying to perform a simple math calculation. I don't understand, why isn't the result correct? decimal d = MyFunction(x, y, z); public decimal MyFunction(string x, string y, string z) { decimal dx = 0; decimal...
0
0
0
0
1
0
I'm having an issue understanding the MixColumns step described here. I know about diffusion and it all makes sense up the the point where it states that each column is treated as a polynomial and multiplied modulo over GF(2^8). BUT..multiplying in GF(2^8). Although the domain is still the same, it is not reversible du...
0
0
0
0
1
0
I am looking for a method to determine if there is a solution to equations such as: 3n1+4n2+5n3=456, where n1,n2,n3 are positive integers. Or more general: are there zero or positive integers n1,n2,n3... that solves the equation k1n1+k2n2+k3n3...=m where k1,k2,k3... and m are known positive integers. I don't need to fi...
0
0
0
0
1
0
With a sine input, I tried to modify it's frequency cutting some lower frequencies in the spectrum, shifting the main frequency towards zero. As the signal is not fftshifted I tried to do that by eliminating some samples at the begin and at the end of the fft vector: interval = 1; samplingFrequency = 44100; signalFrequ...
0
0
0
0
1
0
I have two sets of statistics generated from processing. The data from the processing can be a large amount of results so I would rather not have to store all of the data to recalculate the additional data later on. Say I have two sets of statistics that describe two different sessions of runs over a process. Each set...
0
0
0
0
1
0
The problem is to teach computer to do addition. Computers have a knowledge of a numbers: he "knows" that after 1 goes 2, after 2 goes 3 and so on. Having that data computer can easily get next number. Next, computer have the knowledge that x+0=x and x+(y+1)=(x+1)+y. This axioms let computer to do addition. For exampl...
0
1
0
0
0
0
I want to draw a graph that will be something like this: alt text http://img25.imageshack.us/img25/9786/problemo.png You can see 3 pathes: a, b & c. How can I change position of elements (1,2,3...,9) to make long of the path as short as possible? I mean this lines should be as short as possible. Im very interested in ...
0
0
0
0
1
0
My inner loop contains a calculation that profiling shows to be problematic. The idea is to take a greyscale pixel x (0 <= x <= 1), and "increase its contrast". My requirements are fairly loose, just the following: for x < .5, 0 <= f(x) < x for x > .5, x < f(x) <= 1 f(0) = 0 f(x) = 1 - f(1 - x), i.e. it should be "sym...
0
0
0
0
1
0
I need(for rapid prototyping and libraries integration) something like this(extensions for usual arrays) double[] d; d.SetRow(1,{ 1.1 , 2.0 ,3.3}); var r = d.GetRow(1); d = d.AppendRight(new int[]{1,2,3}); ... Does exist such thing anywhere? On may be anybody implemented it so I do not need do i for me myself?
0
0
0
0
1
0
I need to write some mathematical expressions (like a matrix and mathematical variables...) into my GUI. The MFC static control is very limited on this issue. Especially for the math. symbols. Is there any control or other way to make this happen?
0
0
0
0
1
0
Recently I've been thinking about finite state machines (FSMs), and how I would implement them in software (programming language doesn't matter). My understanding is that deterministic state machines are in widespread use (parses/lexers, compilers and so on), but what's the matter with non-deterministic state machines?...
0
0
0
0
1
0
A developer I am working with is developing a program that analyzes images of pavement to find cracks in the pavement. For every crack his program finds, it produces an entry in a file that tells me which pixels make up that particular crack. There are two problems with his software though: 1) It produces several false...
0
1
0
0
0
0
I'm trying to understang how to use icu::BreakIterator to find specific words. For example I have following sentence: To be or not to be? That is the question... Word instance of break iterator would put breaks there: |To| |be| |or| |not| |to| |be|?| |That| |is| |the| |question|.|.|.| Now, not every pair of break p...
0
1
0
0
0
0
Today, I came across quite strange problem. I needed to calculate string length of a number, so I came up with this solution // say the number is 1000 (int)(log(1000)/log(10)) + 1 This is based on mathematical formula log10x = lognx/logn10 (explained here) But I found out, that in C, (int)(log(1000)/log(10)) + 1 is N...
0
0
0
0
1
0
I have an array of Points. I KNOW that these points represent many lines in my page. How can I find them? Do I need to find the spacing between clouds of points? Thanks Jonathan
0
0
0
0
1
0
I have 3 Vectors, Up Right and Front that represent a direction. I need to convert these into an XYZ angle (3 floats) so i can use with glRotatef() Please help [EDIT] Its not rendering properly. can you see if its anything blatant here: pastebin.com/f6683492d
0
0
0
0
1
0
I have a function to round a number given to the function to the nearest whole pence. <script type='text/javascript'> Math.roundNumber = function(a,b){ if(!isNaN(parseInt(a))){ c = Math.pow(10,b); return (Math.round(a*c)/c); } return false; } </script> however it has come to my attention th...
0
0
0
0
1
0
I just wondered how it is possible to write a user-defined square root function (sqrt) in a way that it interacts properly with F#'s unit system. What it should be like: let sqrt (x : float<'u ^ 2>) = let x' = x / 1.0<'u ^ 2> // Delete unit (x ** 0.5) * 1.0<'u> // Reassign unit But this is disallowed due ...
0
0
0
0
1
0
Not sure if that is the right way to ask this or not but here is the problem. Given a latitude of 26.746346081599476, how do I find the number 26.75 as the 16th greater than the number and 26.6875 as the 16th lower than the number? 26.0 26.0625 26.125 26.1875 26.25 26.3125 26.375 26.4375 26.5 26.5625 26.625 26.6875 My ...
0
0
0
0
1
0
Given a set of n numbers (1 <= n <= 100) where each number is an integer between 1 and 450,we need to distribute those set of numbers into two sets A and B, such that the following two cases hold true: The total numbers in each set differ by at most 1. The sum of all the numbers in A is as nearly equal as possible to ...
0
0
0
0
1
0
Consider a sales department that sets a sales goal for each day. The total goal isn't important, but the overage or underage is. For example, if Monday of week 1 has a goal of 50 and we sell 60, that day gets a score of +10. On Tuesday, our goal is 48 and we sell 46 for a score of -2. At the end of the week, we score t...
0
0
0
0
1
0
I don't have so much a question about how to program something, but rather I'm looking for information on a specific programming language that I can't seem to find anywhere. It seems to be referenced in a few papers I'm looking at. The name of the language is "NeuPro" - it would be for working with Neural Networks an...
0
1
0
0
0
0
If I have the coordinates of a point (lat lon) and the azimuth angle how can I calculate what points are at "the end' of a distance of 10 miles. Ex. I am watching North , I know I am at a certain point ... At 10 miles apart what coordinates has that geo point ?
0
0
0
0
1
0
I have 2 arrays of ints I am using to create a polygon (that looks like a fish). What do I need to do to the arrays to flip the polygon horizontally? x = new int[] { 0, 18, 24, 30, 48, 60, 60, 54, 60, 48, 30, 24, 0 }; y = new int[] { 0, 18, 6, 0, 0, 12, 18, 24, 24, 36, 36, 30, 36 };
0
0
0
0
1
0
I am looking for a Chess AI that can be run on Google App Engine. Most chess AI's seem to be written in C and so can not be run on the GAE. It needs to be strong enough to beat a casual player, but efficient enough that it can calculate a move within a single request (less than 10 secs). Ideally it would be written in ...
0
1
0
0
0
0
It's been a while since my math in university, and now I've come to need it like I never thought i would. So, this is what I want to achieve: Having a set of 3D points (geographical points, latitude and longitude, altitude doesn't matter), I want to display them on a screen, considering the direction I want to take int...
0
0
0
0
1
0
Doing a couple rotations in Matlab, one which is rotation about the y-axis, however online I've found two different answers: here and here. Which is correct, if both how does one get to the other?
0
0
0
0
1
0
I'm having trouble calculating roots of rather large numbers using bc_math, example: - pow(2, 2) // 4, power correct - pow(4, 0.5) // 2, square root correct - bcpow(2, 2) // 4, power correct - bcpow(4, 0.5) // 1, square root INCORRECT Does anybody knows how I can circumvent this? gmp_pow() ...
0
0
0
0
1
0
As you may be able to tell from this screenshot, I am trying to make a physics engine for a platformer I am working on, but I have run into a definite problem: I need to be able to find out the angle of any one of the triangles that you can see make up this mesh, so that I can work out the rotation and therefore angula...
0
0
0
0
1
0
Further to: Choosing an attractive linear scale for a graph's Y Axis And what to do when some of the points are negative? I believe this part of the question was not answered but it seems I can't comment or extend that question so I've created a new one Values -100, 0, 100 with 5 ticks: lower bound = -100 upper b...
0
0
0
0
1
0
What kind of algorithm would be good to cluster and rank blogs in logical communities (tech, entertainment, etc...)? An algorithm to cluster and rank blog posts would be even better. Answers accepted are algorithms, pseudo-code, java code or links to explanations on particular algorithms. Update: So, it seems I would ...
0
0
0
1
0
0
I'd like something that converts a simple calculator like ascii math syntax to mathML. I found this: http://www1.chapman.edu/~jipsen/mathml/asciimath.html But I don't understand how to use it.. I'd like to make it work from the command line for example, so that I feed it some math formula and get back the mathMl versio...
0
0
0
0
1
0
I run a website that allows users to write blog-post, I would really like to summarize the written content and use it to fill the <meta name="description".../>-tag for example. What methods can I employ to automatically summarize/describe the contents of user generated content? Are there any (preferably free) methods o...
0
1
0
0
0
0
I wrote some code that looks like this: def get(x, y) @cachedResults.set(x,y, Math.hypot(x, y)) if @cachedResults.get(x,y).nil? @cachedResults.get(x,y) end Where @cachedResults contained a 2D Array class i wrote (in a few minutes) and the purpose of this function is to make sure that I never have to call Math.hy...
0
0
0
0
1
0
I have a point at 0,0,0 I rotate the point 30 deg around the Y axis, then 30 deg around the X axis. I then want to move the point 10 units forward. I know how to work out the new X and Y position MovementX = cos(angle) * MoveDistance; MovementY = sin(angle) * MoveDistance; But then I realised that these values will ch...
0
0
0
0
1
0
If I have a Catmull-Rom spline of a certain length how can I calculate its position at a certain distance? Typically to calculate the point in a catmull rom spline you input a value between 0 and 1 to get its position via proportions, how can I do this for distances? For example if my spline is 30 units long how can I ...
0
0
0
0
1
0
i have a mysql table for uk people that includes: postcode beginning (i.e. BB2) latitude (int) longitude (int) range (int, in miles, 1-20) http://www.easypeasy.com/guides/article.php?article=64 - theres the article for the sql file i based my table on now it says i can use Pythagoras theorem to calculate distances ba...
0
0
0
0
1
0
I have two double a, b; I know that the following is true -1 <= a/b <= 1 however b can be arbitrarily small. When I do this naively and just compute the value a/b the condition specified above does not hold in some cases and I get values like much greater than 1 in absolute value (like 13 or 14.) How can I ensur...
0
0
0
0
1
0
I would like to know how to optimize the following SQL to let my server load faster and take low usage? I need to calculate the radius distance for a US ZIP Code to get the result, such as 50 miles from a particular ZIP Code ( using latitude and longitude to calculate ) and to getting how many other data ( e.g. others ...
0
0
0
0
1
0
What is problem with follwoing code? I am getting very strange results. Do I missing something? proc Dot {vec1 vec2} { set ret [expr ([lindex $vec1 0]*[lindex $vec2 0])+([lindex $vec1 1]*[lindex $vec2 1])+([lindex $vec1 2]*[lindex $vec2 2])] } proc FindInterSectPoint_LineAndPlane {normalVectorPlane basePoint refPoint ...
0
0
0
0
1
0
I'm currently working on replicating some of the functionality of Matlab's regionprops function in Octave. However, I have a bit of a hangup on a subset of the functionality. The 'Eccentricity', 'MajorAxisLength', 'MinorAxisLength' and 'Orientation' properties are my sticking point. In the documentation, they all de...
0
0
0
0
1
0
I am working on a WISE Installer that needs to run on Java Version 1.5 or greater. So I have it read the registry for the Java Runtime Environment and get the "CurrentVersion" variable - for example 1.6, and place it in a WISE property. I am attempting to build a Launch Condition that prevents the Installer from contin...
0
0
0
0
1
0
I'm trying to reduce a high-dimension dataset to 2-D. However, I don't have access to the whole dataset upfront. So, I'd like to generate a function that takes an N-dimensional vector and returns a 2-dimensional vector, such that if I give it to vectors that are close in N-dimensional space, the results are close in ...
0
0
0
0
1
0
I'm in need of a lightweight library for 2d & 3d vectors and 3x3 & 4x4 matrices. In basic C. Just so I don't reinvent the wheel suboptimally. Any suggestions?
0
0
0
0
1
0
I have thought of some heuristics for a big (higher dimensions) tic-tac-toe game. How do I check which of them are actually consistent? What is meant by consistency anyways?
0
1
0
0
0
0
In Artificial Intelligence we studied the backtracking algorithm. Here is the pseudocode our book offers: function backtrack; begin SL:= [Start]; NSL := [Start]; DE := [] CS := Start; while NSL != [] do begin if CS = goal (or meets goal description) then return SL; ...
0
1
0
0
0
0
I would like my C function to efficiently compute the high 64 bits of the product of two 64 bit signed ints. I know how to do this in x86-64 assembly, with imulq and pulling the result out of %rdx. But I'm at a loss for how to write this in C at all, let alone coax the compiler to do it efficiently. Does anyone have ...
0
0
0
0
1
0
I want to see the values of the function y(x) with different values of x, where y(x) < 5: y = abs(x)+abs(x+2)-5 How can I do it?
0
0
0
0
1
0
I'm making a game in c++. It is a card game. I have made 13 cards that rotate about a point to arc out to make your hand. I need a way to figure out which card the user clicks on. My cards are basically rectangles rotated about a point that is in the center of the cards. I was thinking of maybe getting the mouse point ...
0
0
0
0
1
0
I have a dynamic number of equally proportioned and sized rectangular objects that I want to optimally display on the screen. I can resize the objects but need to maintain proportion. I know what the screen dimensions are. How can I calculate the optimal number of rows and columns that I will need to divide the screen ...
0
0
0
0
1
0
Is there some reason that identical math operations would take significantly longer in one Silverlight app than in another? For example, I have some code that takes a list of points and transforms them (scales and translates them) and populates another list of points. It's important that I keep the original points int...
0
0
0
0
1
0
I am trying to do problem 254 in project euler and arrived at this set of functions and refactor in Haskell: f n = sum $ map fac (decToList n) sf n = sum $ decToList (f n) g i = head [ n | n <- [1..], sf n == i] sg i = sum $ decToList (g i) answer = sum [ sg i | i <- [1 .. 150] ] Where: f (n) finds the sum of the...
0
0
0
0
1
0
As a programmer, I frequently need to be able to know the how to calculate the number of permutations of a set, usually for estimation purposes. There are a lot of different ways specify the allowable combinations, depending on the problem at hand. For example, given the set of letters A,B,C,D Assuming a 4 digit r...
0
0
0
0
1
0
I'm trying to code a 3d wall like http://www.flashloaded.com/flashcomponents/3dwall/ The shape I am looking to create is like a bath or arena where it is a curve cornered rectangle with sloping sides. The image below shows what i'm trying to achieve if viewed from above. I hope that helps. Can anyone give me some ide...
0
0
0
0
1
0
I have a circle. Inside the circle is a point. I have a vector originating at this point. I'd like to know what point on the circle this vector intersects. Here is a drawing: http://n4te.com/temp/circle.png http://n4te.com/temp/circle.png The red dot is the point I am trying to determine. I know these things: the cente...
0
0
0
0
1
0
I have a N-dimensional vector, X and 'n' equidistant points along each dimension and a parameter 'delta'. I need a way to find the total of n^N vectors enclosed by the Hypercube defined with the vector X at the center and each side of Hypercube being of size 2*delta. For example: Consider a case of N=3, so we have a C...
0
0
0
0
1
0
I need to be able to generate a single random number and then use that number to seed a theoretically infinitely large 2d plane on the fly with boolean values. I need a function I can call that is deterministic with three inputs (x, y, and the random seed) and returns a pseudo-random result back: int r = random() //......
0
0
0
0
1
0
First of all: This is not a question about how to make a program play Five in a Row. Been there, done that. Introductory explanation I have made a five-in-a-row-game as a framework to experiment with genetically improving AI (ouch, that sounds awfully pretentious). As with most turn-based games the best move is decided...
0
1
0
0
0
0