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 ray, going outwards from a camera, I need to find the length of the ray inside the cube. Note that the camera could be inside the cube, in which case it should return the distance to the edge of the cube. It's for a shader, so it should be relatively small and involve a minimum of branching. Any ideas?
0
0
0
0
1
0
I'm working on a touch based game, and I'm having issues drawing a path the user has touched through. I'm trying to mimic something like these apps http://www.youtube.com/watch?v=G3CECr6mT1Q or http://www.youtube.com/watch?v=r34-_0wrVC4 I'm doing this in XNA/C#. My issue is: I have the set of waypoints that define that users touch path. I wasnt sure how I could get a stylized line between all these points, so I thought "hey, I will just have a really small image that is 'the line', and draw it at every spot between the waypoints, and rotate it accordingly. I'm not sure this if this is the best solution or not. But I was stuck because I did not know how to get all the coordinates between these two points. I have the two points, I can get a vector from the first to second, etc, but I cant seem to get the math correct. Any suggestions or help? Thanks!
0
0
0
0
1
0
I'm developing a simple text battle game and having some issues calculating how much XP should be earned after a battle, theres a few factors that i want to consider: 1) Players should of course earn good XP if they beat someone of the same level 2) Players should earn great XP if they beat someone of a higher level 3) Players should earn poor XP if they defeat someone of a lower level. 4) The above should scale nicely, i.e. if player A is level 10 and battles Player B who's level 9 or 11 the difference shouldn't be huge (they would of course gain more XP for defeating the level 11 character but we wouldn't expect this to be huge), but if he was to battle a level 5 or 15 this difference should be huge. Just having trouble calculating something that works well in all scenarios, currently my XP table looks like the below: Current Level XP Needed Increase from Last Level 1 30 0 2 65 35 3 106 41 4 154 48 5 210 56 ... 10 672 123 In PHP my code looks like the below to calculate the XP Needed: $offset = 30; $multiplier = 1.17; $base = $prevXp * $multiplier; $xp = $base + $offset; I've tried a few different things but i haven't been impressed with any of them, I'd like to work with calculating the difference in XP between the two players and then using some kind of multiplier but i haven't been impressed with the results so far. Any help / input would be appreciated.
0
0
0
0
1
0
What functions can I use in Accelerate.framework to scale a vector by a scalar, and normalize a vector? I found one I think might work for scaling in the documentation but I am confused about it's operation. vDSP_vsma Vector scalar multiply and vector add; single precision. void vDSP_vsma ( const float *__vDSP_A, vDSP_Stride __vDSP_I, const float *__vDSP_B, const float *__vDSP_C, vDSP_Stride __vDSP_K, float *__vDSP_D, vDSP_Stride __vDSP_L, vDSP_Length __vDSP_N );
0
0
0
0
1
0
With this toolbox I was performing calibration of my camera. However the toolbox outputs results in matrix form, and being a noob I don't really understand mathy stuff. The matrix is in the following form. Where R is a rotation matrix, T is a translation vector. And these are the results I got from the toolbox. It outputs values in pixels. -0.980755 -0.136184 -0.139905 217.653207 0.148552 -0.055504 -0.987346 995.948880 0.126695 -0.989128 0.074666 371.963957 0.000000 0.000000 0.000000 1.000000 Using this data can I know how much my camera is rotated and distance of it from the calibration object?
0
0
0
0
1
0
Given, 1*2^1 + 2*2^2 + 3*2^3 + 4*2^4 + ... d * 2^d = sum(r * 2^r, r from 1 to d) How can we infer to the following solution? = 2 (d-1) * 2^d + 2 Thank you
0
0
0
0
1
0
I have set of x coordinates x={0,32,64,...256} and y={2,6,4....},i ll plot the graph along x_y axis,then i drag the point 128 to 64 along x axis,now i want left side of the point to be compressed and right side to be enlarged.How can i recalculate the coordinates of the graph in C. Any help is appreciated. here is my code... int arr_x[]={32,64,96,128,160,192,224,256}; int arr_y[]={7,12,8,6,14,22,18,24}; int x1=64,x2=128; //drag x2 to x1 int min_val=abs(arr_x[0]-x2); int idx=0; for (int i = 1; i < 8; i++) { if ((abs(arr_x[i] -x2)) < min_val) { min_val = abs(arr_x[i] - x2); idx = i; } } float r;//ratio for compression and enlarge if(x2>x1) { arr_x[idx]=x2; r=(float)x2/x1; for(int i=0;i<=idx;i++) { arr_x[i]=arr_x[i]*r; } for(int i=idx+1;i<8;i++) { arr_x[i]=arr_x[i]/r; } } else { arr_x[idx]=x2; r=(float)x1/x2; for(int i=0;i<=idx;i++) { arr_x[i]=arr_x[i]*r; } for(int i=idx+1;i<8;i++) { arr_x[i]=arr_x[i]/r; }
0
0
0
0
1
0
Sorry if this is a silly question, but it is useful for my current lexical analysis project. Is there any built-in and preferably culture-based (language-based) function in the .Net framework to convert back and forth from string with numbers and the words that represent them? Like "1" <-> "one", "2" <-> "two", "3" <-> "three" and like this? I know this can be made using a dictionary or a list with all the valid correspondences, but that is too much work if there is already a built-in function that one can use. Edit: People who voted to close may have not understood that I was not asking how to convert decimal representation to strings, but the reverse operation: from a string to it's decimal representation. The links provided do not address this problem. Thank you very much.
0
1
0
0
0
0
Hello Assume I have the set of numbers I want a quick to calculate some measure of uniformity. I know the variance is the most obvious answer but i am afraid the complexity of naive algorithm is too high Anyone have any suggestions?
0
0
0
0
1
0
I've been tinkering around trying to make an AI player for the popular card game, Dominion (http://www.boardgamegeek.com/boardgame/36218/dominion). If you are not familiar with the game, it is basically a very streamlined cousin of Magic: The Gathering, where there is a large-ish library of cards with different rules on them. Over the course of a game, players buy these cards and incorporate them into their deck. I am interested in this game from a machine learning perspective - I want to pit bots against each other, have them play millions of games, and try to datamine insights that will make them play better. I am unsure how to separate the rules of the game (the verbatim instructions printed on each card) from the core AI decision-making logic. The obvious path that I have started down is creating a class for each Card, and putting both rules and AI stuff in the same place. This is sort of gross - but it seems like the path of least resistance. But maybe it is best for each card to support some sort of interface and then have AI components code against these? Is there a "Correct" OOP design for this? Or several reasonable possibilities?
0
1
0
0
0
0
after studying decision tree for a while, I noticed there is a small technique called boosting. I see in normal cases, it will improve the accuracy of the decision tree. So I am just wondering, why don't we just simply incorporate this boosting into every decision tree we built? Since currently we leave boosting out as a separate technique, so I ponder: are there any disadvantages of using boosting than just using a single decision tree? Thanks for helping me out here!
0
1
0
1
0
0
How to identify if a given number is a composite number or not?
0
0
0
0
1
0
I would like to know a good way of checking if a number x is a rational (two integers n,m exist so that x=n/m) in python. In Mathematica, this is done by the function Rationalize[6.75] : 27/4 I assume this question has an answer for a given accuracy. Is there a common algorithm of obtaining these two integers?
0
0
0
0
1
0
It recently emerged on a large poker site that some players were possibly able to see all opponents cards as they played through exploiting a security vulnerability that was discovered. A naïve cheater would win at an incredibly fast rate, and these cheats are caught very quickly usually, and if not caught quickly they are easy to detect through a quick scan through their hand histories. The more difficult problem occurs when the cheater exhibits intelligence, bluffing in spots they are bound to be called in, calling river bets with the worst hands, the basic premise is that they lose pots on purpose to disguise their ability to see other players cards, and they win at a reasonably realistic rate. Given: A data set of millions of verified and complete information hand histories Theoretical unlimited computer power Assume the game No Limit Hold'em, although suggestions on Omaha or limit poker may be beneficial How could we reasonably accurately classify these cheaters? The original 2+2 thread appeals for ideas, and I thought that the SO community might have some useful suggestions. It's an interesting problem also because it is current, and has real application in bettering the world if someone finds a creative solution, as there is a good chance genuine players will have funds refunded to them when identified cheaters are discovered.
0
1
0
0
0
0
I have a bounding box, and a number of points inside of it. I'd like to add another point whose location is farthest away from any previously-added points, as well as far away from the edges of the box. Is there a common solution for this sort of thing? Thanks!
0
0
0
0
1
0
Hey all, I need to compare a double inside an if statement. If the double has no value/is equal to zero, it should do nothing. Otherwise it should do something. My if statement if (doubleNameHere > 0) doesn't work. Obviously I'm missing something fundamental here, any ideas?
0
0
0
0
1
0
I've googled this but possibly typing in the wrong thing. I see hexadecimal numbers knocking about such as 3A and 0x3A, but what does the leading 0x mean? I read somewhere it means the number is signed, but converting a negative decimal to hex in calc doesn't produce a hexadecimal number with the leading 0x. Any points much appreicated.
0
0
0
0
1
0
Possible Duplicate: Java : Is there a good natural language processing library are there any known open source distributions that one can use like nltk for python?
0
1
0
0
0
0
I have a set of informal documents (couple of thousands) which I want to apply topic modeling (MALLET) on. The problem is, there are a considerable number of misspelled words in the documents. Most are intentional, such as short-forms and local lingo like `'juz' -> 'just', 'alr' -> 'already'. A couple of these variations exists, due to the different authors' peculiar styles of writing. After feeding them to MALLET, I kinda bothered that one of the topics generated is actually a set of misspelled stopwords. I believe these words are mostly used in the small subset of documents from the same author, hence MALLET picked it up. My question is, do I spell-check and correct these sets of misspelled words, and perhaps save the corrected text somewhere, before conducting further tasks on them? I suppose this would meant that I do need to manually verify the corrections before committing right? What would be the most "efficient" way to do this? Or do I actually ignore these misspelled words?
0
1
0
0
0
0
I'm looking at analyzing a test. It consists of four questions with ten options each. From each question, three options must be selected. That of course always yields a total of 12 answers. Analyzing the number of possible combinations using Ruby's [].combination my Dell Workstations freezes up and fails to produce sane values. Is that calculation really so extremely intense/large? Using 40 options over 12 answers, I figured I should run: [0...39].combination(12){|x| p x } I also found the Wikipedia article on Combination. But being handicapped in terms of math, it really did not make my any smarter. I would madly appreciate any help I can get on this matter. Thanks everybody. Secondary/follow-up question: Plus points to anyone who can figure out a smart way to generate all possible combinations. It's needed for a "offline" Ruby application simulating all possible answers. My brain is dizzy from analyzing the docs – but I cannot seem to find an efficient way to achieve this task. Ideally, I would need one giant array containing ints representing the options selected: [[0, 1, 2], [0, 1, 2], [0, 1, 2], [0, 1, 2]] ...would for example represent a scenario where question one, two, three and four was answered using options 0, 1 and 2.
0
0
0
0
1
0
I am aware that foo[bar] is equal to *(foo + bar), but what is *foo[bar] equal to, such as accessing *argv[2]? I am somewhat confused in understanding this, I assumed maybe something like *(*(foo) + bar) but am unsure.. I apologize if this is a simple answer.
0
0
0
0
1
0
I'm interested in doing text categorization using LibSVM. How do you recommend I convert the terms/words to numerical data, so LibSVM can understand it? Thank you!
0
0
0
1
0
0
I am trying to use the RSA algorithm for learning purposes. Now I have the following issue. I stuck at the following point. i need to solve the following function: c = value^e % n c = encrypted result value = the number to be encrypted d = my public key n = RSA module I only use double as a datatype for all variables. The function I solved with the following line: double c = Math.Pow(value, e) % n The issue here is, that it looks like the math.pow function produces a wrong value, it seems like it a bit inaccurate. When I try this with the Windows calculator I get a much better result which is correct. My questions: Does someone know, how to solve this to get the correct result to work with RSA. The calculation of all teh other parts is definetly correct. It only can be the math.pow or the modulus thing.
0
0
0
0
1
0
I am writing a Q and A web application. I'm wondering if there's any library of web services that can allow user to create math equations easily in the web editor? Thanks
0
0
0
0
1
0
This is not related to any language atm, only math algorithm required. I have some image, lets say this one I need to cut tree from this image, sky with clouds and grass should be threated as background. Thanks for any help.
0
0
0
0
1
0
I'm coding a flocking algorithm in Java but I'm stuck at a certain point (using the Ardor3D libraries, in a 2D plane). Basically, I need to find the angle difference to add to the current rotation. If you can only get the way it should be pointing with polar coordinates with 0 degs at north and not the difference, not to worry -- I have a method which returns the angle difference taking into account the wraparound on the angle and negative angles. At the moment, I have the following code, which clearly wouldn't work since the algorithm has no reference to the initial rotation: long tpf = currUpdateTimeMS - lastUpdateTimeMS; Vector2 pos = new Vector2(); rt.getPosition(pos); double rot = pos.angleBetween(app.getAvgBoidPos(new Vector2()).normalizeLocal()); rt.setRotation(rot); pos.addLocal( Math.cos((rot - MathUtils.HALF_PI)) * (tpf / 10f), Math.sin((rot - MathUtils.HALF_PI)) * (tpf / 10f) ); rt.setPosition(pos); super.updateLogic(); Updated code (not working, from first answer): long tpf = currUpdateTimeMS - lastUpdateTimeMS; //rt.setRotation(rt.getRotation() + ((tpf / (ROT_SPEED / 2f)) % 360)); Vector2 avgpos = app.getAvgBoidPos(new Vector2()); Vector2 pos = rt.getPosition(new Vector2()); avgpos.subtractLocal(pos); double angleRads = rt.getRotation() * FastMath.DEG_TO_RAD; double rot = MathUtils.acos(( (avgpos.getX() * MathUtils.sin(angleRads) ) + (avgpos.getY() * MathUtils.cos(angleRads) )) / ((Math.pow(avgpos.getX(), 2) + Math.pow(avgpos.getY(), 2)) * 0.5)); double adegdiff = rot * FastMath.RAD_TO_DEG; rt.setRotation(rt.getRotation() - adegdiff); double newrot = rt.getRotation(); pos.addLocal( Math.cos((newrot - MathUtils.HALF_PI)) * (tpf / 10f), Math.sin((newrot - MathUtils.HALF_PI)) * (tpf / 10f) ); rt.setPosition(pos); super.updateLogic(); Another modification based on the other answer: long tpf = currUpdateTimeMS - lastUpdateTimeMS; //rt.setRotation(rt.getRotation() + ((tpf / (ROT_SPEED / 2f)) % 360)); Vector2 avgpos = app.getAvgBoidPos(new Vector2()); Vector2 pos = rt.getPosition(new Vector2()); avgpos.subtractLocal(pos); double rot = pos.angleBetween( app.getAvgBoidPos(new Vector2()).normalizeLocal() ) - (rt.getRotation() * MathUtils.DEG_TO_RAD); rt.setRotation(rt.getRotation() - (rot * MathUtils.RAD_TO_DEG)); double newrot = rt.getRotation(); pos.addLocal( Math.cos((newrot - MathUtils.HALF_PI)) * (tpf / 10f), Math.sin((newrot - MathUtils.HALF_PI)) * (tpf / 10f) ); rt.setPosition(pos); super.updateLogic(); I'm not really too good at Maths problems, so code would be helpful rather than formulas :) Inputs Current position of entity Current rotation of entity (polar-oriented) in degrees Output Degrees or radians to add or subtract to current rotation ... or degrees or radians expressed as polar-oriented angle Thanks in advance if you can help :) Chris
0
0
0
0
1
0
I have a problem with the code below. It is not performing any function now... neither add nor subtract nor divison nor multiplication. Any help will be appreciated... I need explanation... so that I can understand it and get over with it :D #include <iostream> using namespace std; // Class Definitions class RationalNumber { public: RationalNumber(int, int, int, int); RationalNumber operator+(RationalNumber); RationalNumber operator-(RationalNumber); RationalNumber operator*(RationalNumber); RationalNumber operator/(RationalNumber); RationalNumber operator<(RationalNumber); RationalNumber operator>(RationalNumber); RationalNumber operator<=(RationalNumber); RationalNumber operator>=(RationalNumber); RationalNumber operator==(RationalNumber); RationalNumber operator!=(RationalNumber); private: int numerator; int denominator; int numerator2; int denominator2; }; // end RationalNumber class // RationalNumber class member-function definitions RationalNumber::RationalNumber(int num, int denom, int num2, int denom2) { numerator = num; denominator = denom; numerator2 = num2; denominator2 = denom2; //for first fraction if (denominator == 0 || denominator < 0) cout << "ERROR:Denominator can not be zero or less than zero." << " "; else //Reduces the fraction to lowest terms. { int i = numerator > denominator ? numerator : denominator; while(i > 1) { if(numerator % i == 0 && denominator % i == 0) { numerator /= i; denominator /= i; } --i; } } cout << "Simplified fraction one is: " << numerator << " / " << denominator << " "; //For second fraction if (denominator2 == 0 || denominator2 < 0) cout << "ERROR:Denominator can not be zero or less than zero" << " "; else //Reduces the fraction to lowest terms. { int j = numerator2 > denominator2 ? numerator2 : denominator2; while(j > 1) { if(numerator2 % j == 0 && denominator2 % j == 0) { numerator2 /= j; denominator2 /= j; } --j; } } cout << "Simplified fraction two is: " << numerator2 << " / " << denominator2 << " "; } // addition operator RationalNumber RationalNumber::operator+(RationalNumber a) { RationalNumber temp=RationalNumber(1,2,3,4); temp.numerator = numerator + a.numerator; temp.denominator = denominator + a.denominator; temp.numerator2 = numerator2 + a.numerator2; temp.denominator2 = denominator2 + a.denominator2; return temp; } // subtraction operator RationalNumber RationalNumber::operator-(RationalNumber a) { RationalNumber temp=RationalNumber(1,2,3,4); temp.numerator = numerator - a.numerator; temp.denominator = denominator - a.denominator; temp.numerator2 = numerator2 - a.numerator2; temp.denominator2 = denominator2 - a.denominator2; return temp; } // multiplication operator RationalNumber RationalNumber::operator*(RationalNumber a) { RationalNumber temp=RationalNumber(1,2,3,4); temp.numerator = numerator * a.numerator; temp.denominator = denominator * a.denominator; temp.numerator2 = numerator2 * a.numerator2; temp.denominator2 = denominator2 * a.denominator2; return temp; } // division operator RationalNumber RationalNumber::operator/(RationalNumber a) { RationalNumber temp=RationalNumber(1,2,3,4); temp.numerator = numerator / a.numerator; temp.denominator = denominator / a.denominator; temp.numerator2 = numerator2 / a.numerator2; temp.denominator2 = denominator2 / a.denominator2; return temp; } int main() { int top; int bot; int top2; int bot2; cout << "Please enter the Numerator for fraction one: "; cin >> top; cout << "Please enter the Denominator for fraction one: "; cin >> bot; cout << "Please enter the Numerator for fraction two: "; cin >> top2; cout << "Please enter the Denominator for fraction two: "; cin >> bot2; RationalNumber A(top, bot, top2, bot2); return 0; }
0
0
0
0
1
0
I am learning C and writing a simple program that will take 2 string values assumed to each be binary numbers and perform an arithmetic operation according to user selection: Add the two values, Subtract input 2 from input 1, or Multiply the two values. My implementation assumes each character in the string is a binary bit, e.g. char bin5 = "0101";, but it seems too naive an approach to parse through the string a character at a time. Ideally, I would want to work with the binary values directly. What is the most efficient way to do this in C? Is there a better way to treat the input as binary values rather than scanf() and get each bit from the string? I did some research but I didn't find any approach that was obviously better from the perspective of a beginner. Any suggestions would be appreciated!
0
0
0
0
1
0
In my web application I am using two different Languages namely English and Arabic. I have a search box in my web application in which if we search by name or part of the name then it will retrieve the values from DB by comparing the "Hometown" of the user Explanation: Like if a user belongs to hometown "California" and he searches a name say "Victor" then my query will first see the people who are having the same hometown "California" and in the list of people who have "California" as hometown the "Victor" *name* will be searched and it retrieve the users having "California" as their hometown and "victor" in their name or part of the name. The problem is if the hometown "California" is saved in English it will compare and retrieve the values. But "California" will be saved as "كاليفورنيا" in Arabic. In this case the hometown comparison fails and it cant retrieve the values. I wish that my query should find both are same hometown and retrieve the values. Is it possible? What alternate I should think of for this logic for comparison. I am confused. Any suggestion please? EDIT: *I have an Idea such that if the hometown is got then is it possible to use Google translator or transliterator and change the hometown to another language. if it is in english then to arabic or if it is in english then to arabic and give the search results joining both. Any suggestion?*
0
1
0
0
0
0
Using a php like so.. for($i = 0; $i < 30; $i++) ... I have this html element that is rendered several times. I want to, each time we arrive at the sixth element, it adds a "style:margin-right: 0px;" for example. My question is: How can we find always the 6th element ? Update: So that can mark the 6th element, then the 12th element, then the 18th element then the 24th and, at least, the 30th. Thanks in advance, MEM
0
0
0
0
1
0
I have two spaces (not necessarily equal in dimension) with N points. I am trying to find a bijection (pairing) of the points, such that the distances are preserved as well as possible. I can't seem to find a discussion of possible solutions or algorithms to this question online. Can anyone suggest keywords that I could search for? Does this problem have a name, or does it come up in any domain?
0
0
0
1
1
0
A friend of me posted a link on my Facebook page to a webapplication which is capable of having a real conversation with you. First I was a bit skeptic about it but after I played with it I found it pretty awesome. I'm really wondering if this is going to be the future of the web. The website claims it uses Artificial Intelligence and the bot uses the answers and questions it gets for it's users. As a programmer I would like to know what kind of technology they used to enable this application to give such good answers. Does anyone know this by any chance? The application is called: Cleverbot. Note: I am not in any way affiliated with this company/website
0
1
0
1
0
0
How can you use srand with a set seed with min and max values? I need to create set of random numbers, that can be recreated. Or what other options are there?
0
0
0
0
1
0
Creating a puzzle game where I want the shapes to morph based on user input. A user clicks on a vertex and drags the point changing the shape. For example if a user clicks on A and drags downward (shortening segment AG), point B would would down an equal amount (shortening BC), point F would move to the left shortening both AF and FG, finally point E would also shift to the left to stay in line with point F. There is an array of line segments, each line segment is itself an array that contains the two end points. When shifting I have a loop search for all the equal points. None of this is set in stone willing to make any changes needed to get this to work. I've been working on this for two days and am completely stumped. A B-------------\ | | \ | | \ | | \ | | \ C------------------\F | G | | | | | D-------------------E
0
0
0
0
1
0
I have a query relating to reverse circular motion. I have the code below. case 1 is clockwise circular motion and case 2 is anticlockwise. The switch between case 1 and 2 is done with a user touch. When it switches from clockwise to anticlockwise it uses the same value in the sin() and cos() which is timer/1.5. This causes the anticlockwise motion to begin from a different position on my planet. I want to calculate the value that is required for my timer in order for the anticlockwise motion to start from where it left off during the clockwise motion and thus have a smooth transition. Does anyone know the correct Math for this as my mind is stuck? Just a small explanation of the code below. I am calculating the position of my Robot by taking the x and y coordinates of the Planet it is on and performing a circular motion with a radius of the Planet's radius + 55 (which is a comfortable height for my sprite). case 1: positionX = AttachedPlanet.positionX + sin(timer/1.5)*(AttachedPlanet.planetRadius + 55); positionY = AttachedPlanet.positionY + cos(timer/1.5)*(AttachedPlanet.planetRadius + 55); timer = timer + 0.02; break; case 2: positionX = AttachedPlanet.positionX + cos(timer/1.5)*(AttachedPlanet.planetRadius + 55); positionY = AttachedPlanet.positionY + sin(timer/1.5)*(AttachedPlanet.planetRadius + 55); timer = timer + 0.02;
0
0
0
0
1
0
I'm struggling to find whether a word is noun or verb etc I found the MIT Java Wordnet Interface there was a sample code like this, but when i use this i get error that Dictionary is abstract class and cannot be instantiated public void testDictionary() throws IOException { // construct the URL to the Wordnet dictionary directory String wnhome = System.getenv("WNHOME"); String path = wnhome + File.separator + "dict"; URL url = new URL("file", null, path); // construct the dictionary object and open it IDictionary dict = new Dictionary(url); dict.open(); // look up first sense of the word "dog" IIndexWord idxWord = dict.getIndexWord("dog", POS.NOUN); IWordID wordID = idxWord.getWordIDs().get(0); IWord word = dict.getWord(wordID); System.out.println("Id = " + wordID); System.out.println("Lemma = " + word.getLemma()); System.out.println("Gloss = " + word.getSynset().getGloss()); } i also got another java interface to wordnet danbikel's interface but i dont get answer for the query WordNet wn=new WordNet("/usr/share/wordnet"); Morphy m = new Morphy(wn); System.out.println(m.morphStr("search","NOUN").length); Always the string length is 0, what is the correct arguments for this method? here is the javadoc of the method, what am i doing wrong? public String[] morphStr(String origstr, String pos) Tries several techniques on origstr to find possible base forms (lemmas). Specified by: morphStr in interface MorphyRemote Parameters: origstr - word or collocation, separated either by whitespace, '_' or '-', to find lemma of pos - part of speech of origstr Returns: array of possible lemmas for origstr, possibly of length 0 if no lemmas could be found
0
1
0
0
0
0
I am looking for an example that I can solve using Finite Element Method that is not mechanics / physics related. All examples in textbooks revolve around truss, beams, loads, etc. Does anyone know other areas preferably with known differential equation, and enough data to work with? From sociology perhaps, or climate prediction?
0
0
0
0
1
0
I want to use Latent Semantic Analysis for a small app I'm building, but I don't want to build up the matrices myself. (Partly because the documents I have wouldn't make a very good training collection, because they're kinda short and heterogeneous, and partly because I just got a new computer and I'm finding it a bitch to install the linear algebra and such libraries I would need.) Are there any "default"/pre-built LSA implementations available? For example, things I'm looking for include: Default U,S,V matrices (i.e., if D is a term-document matrix from some training set, then D = U S V^T is the singular value decomposition), so that given any query vector q, I can use these matrices to compute the LSA projection of q myself. Some black-box LSA algorithm that, given a query vector q, returns the LSA projection of q.
0
1
0
1
0
0
I've a project of natural language processing but for that i need to crawl many web articles from some sources like Yahoo news, Google news or blogs... I'm a java developper (so i'd rather use java tools). I guess i can parse each source website on my own and extract the articles with HttpClient / XPath but i'm a bit lazy :) is there a way so that i won't have to make a parser per source? (I'm not only interested by new articles but articles from 2000 to now too)
0
1
0
0
0
0
I know it might sound strange but I would like to know one thing in this new world where Microsoft Visual F# is getting into. There are many application of this language, I am going to learn, regarding parsing, functional programming, structured programming... But what about artificial intelligence? Are there any applications for Fuzzy Logic? Is F# a good language to be used for Fuzzy Logic applications? At university we are studying Prolog and similar languages. Prolog is able to create complex query in a very plain and short expresisons (by taking advantage of predicates and facts). Is F# able to do this? Thank you in advance.
0
1
0
0
0
0
Hi I am trying to work out the best way to do the following say I sell an item for 22.55 the GST on that is 10% which = 2.25 However it seems when I run the following var sum = (.10 * 22.55); it returns $2.250000002 How do I make it so it only shows the real dollars? $2.25 Thanks
0
0
0
0
1
0
This is really the very first try.. so all kind of suggestions are welcome. I am looking for software that recognizes a mathematical function from a bitmap / jpg. E.g. if you have the graph of some log(x) as jpg and you´d enter the x,y scales the program should tell that log(x) was used to create this. Maybe some OMR software might help, maybe it´s rather some math tool. Is it possible at all?
0
0
0
0
1
0
How do you fade in a hex colour? based on a scale of 0 - 100. Say I want an element to be green when awarded 100, and white when 0, with all the shades in between. Update: HEX>RGB>HSV - Helpful collection of routines here: http://php.amnuts.com/index.php?do=view&id=16&file=class.image.php
0
0
0
0
1
0
As the subject says, What does the symmetry mean when graphing real vs imaginary components of a FFT? And does the clustering imply periodicity in the data? I ask this because I did a project with predicting sunspot count with a neural network and had to find the periodicity of the data (and used FFT which worked). Someone recommended I look at graphing the real vs imaginary components, but I don't understand what I am looking at.
0
0
0
0
1
0
I am not sure if this is solveable, but I though I will ask anyway. In my company we deal with massive enrollment camps where small teams of 5 to 10 people go to a village and enroll people. The enrollment involves entering some data, capturing fingerprints and taking a mug-shot of the end-user using a webcam. Understandably enrollment is done by external vendors to whom we have outsourced the activity. Since the no of records are overwhelmingly large trying to verify records manually is making the entire process slow. So we have automated as many things as possible except for one thing, which is to check if the photo captured using the webcam is of good quality. I know, "Good Quality" is a vague term which cannot be translated to a software based solution. However, while trying to define Good Quality to myself, I found this: http://en.wikipedia.org/wiki/Image_quality Now, finally coming to my question, what parts of these image quality checks can be automated. Note: The photographs will be printed on a smart-card in stamp-size. They would barely be 100x125 pixels at 300 DPI. Cheers, Raghu
0
0
0
1
0
0
I'm not great with statistical mathematics, etc. I've been wondering, if I use the following: import uuid unique_str = str(uuid.uuid4()) double_str = ''.join([str(uuid.uuid4()), str(uuid.uuid4())]) Is double_str string squared as unique as unique_str or just some amount more unique? Also, is there any negative implication in doing something like this (like some birthday problem situation, etc)? This may sound ignorant, but I simply would not know as my math spans algebra 2 at best.
0
0
0
0
1
0
After being burnt several times on things that seemed "obviously fast enough" but sucked performance-wise under load, I'm starting to think that my "gut feeling" might be not enough when doing capacity planning, and some theoretical background is necessary. So - community, can you point me to good resources on applications of queuing theory to programming? Whatever - articles, case studies, books. I found a couple of books that seem to be relevant so far; I'd be happy to hear your opinions on them, if you're familiar: Software Performance and Scalability: A Quantitative Approach The Art of Computer Systems Performance Analysis: Techniques for Experimental Design, Measurement, Simulation, and Modeling Performance by Design: Computer Capacity Planning By Example
0
0
0
0
1
0
for my final thesis i am trying to build up an 3d face recognition system by combining color and depth information. the first step i did, is to realign the data-head to an given model-head using the iterative closest point algorithm. for the detection step i was thinking about using the libsvm. but i dont understand how to combine the depth and the color information to one feature vector? they are dependent information (each point consist of color (RGB), depth information and also scan quality).. what do you suggest to do? something like weighting? edit: last night i read an article about SURF/SIFT features i would like to use them! could it work? the concept would be the following: extracting this features out of the color image and the depth image (range image), using each feature as a single feature vector for the svm?
0
0
0
1
0
0
I am trying to train a Naive Bayes classifier with positive/negative words extracting from a sentiment. example: I love this movie :)) I hate when it rains :( The idea is I extract positive or negative sentences based on the emoctions used, but in order to train a classifier and persist it into database. The problem is that I have more than 1 million such sentences, so if I train it word by word, the database will go for a toss. I want to remove all non-relevant word example 'I','this', 'when', 'it' so that number of times I have to make a database query is less. Please help me in resolving this issue to suggest me better ways of doing it Thank you
0
1
0
0
0
0
If @prescribed_wod_count = @user.workouts.rx_workouts.count returns 4 and @user_workout_count = @user.workouts.count returns 26 how come <%= number_to_percentage(@prescribed_wod_count / @user_workout_count) %> returns 0.000% and not 15% ?
0
0
0
0
1
0
Please tell what is termin "full fledged KI"? As i understand it is part of data mining for text analyzing. Am i right? Some interesting and useful links will be fine! Thank you!!!
0
1
0
0
0
0
I was apartment-shopping via Google Maps, copying various listings into a spreadsheet so I could more easily compare and attach notes, when I realized how unnecessarily repetitive and inefficient this was. I could easily write a script to automatically query Google and extract the data I need, but to get some of the data (e.g. contact phone number) requires that I follow a link to a listing-specific site and hunt-around for the data, and I've never written a web-crawler that dynamic. What are the common data-mining and/or machine learning techniques and tools for extracting a "best-guess" for a piece of info given arbitrary HTML?
0
0
0
1
0
0
recently I came across this term,but really have no idea what it refers to.I've searched online,but with little gain. Thanks.
0
0
0
1
0
0
Yesterday i had a look at how to set values of variables from nummbers stored in external txt files the variables then needed to be added up so i used trial and error first ((XVAL) + (NEWVAL)) assuming that XVAL was set to 10 and NEWVAL was set to 20 i expected to get the answer of thirty but waqs presented with the new value of 10 20 VB.net pysicaly added the two values together but i wanted the mathematical product of the two which is ((10) + (20)) = 30 yep its a newb question could anyone explain how to achieve what im affter
0
0
0
0
1
0
Ok, so for a program I need to know two facts, the length of input and which highest number this length is closest to that is divisible by 4. For example. If the length is 1, I want to record 4. If the length is 3, I want to record 4. If the length is 5, I want to record 8. Mathematically I can divide the length by 4, this gives a decimal. If I round it up and times by 4 it gives me the answer I need. So, how do I get C to round up the contents of an int? I may be overcomplicating this so please say if I have missed something simple to do this. Edit: I should add, I already know the length, this is something I would enter myself.
0
0
0
0
1
0
I am trying to solve a mathematical problem programatically. Having a way to generate base 3 numbers would make it very easy to solve the problem. Do you know of any language that has in-built support for working with numbers of non-trivial base? It would be equally great if you could point me to some tool that can help me generate a sequence of base 3 numbers
0
0
0
0
1
0
Currently, for my function below...the image will be resized based on the longest side. Basically the image has a larger height, the height will be 200px. The width will be just...whatever... If the image has a larger width, the width will be 200px, and the height will adjust accordingly. How do I flip this around!? I want this function to take into account the shortest side. Am I writing this function incorrectly?? def create_thumbnail(f, width=200, height=None, pad = False): #resizes the longest side!!! doesn't even care about the shortest side #this function maintains aspect ratio. if height==None: height=width im = Image.open(StringIO(f)) imagex = int(im.size[0]) imagey = int(im.size[1]) if imagex < width or imagey < height: pass #return None if im.mode not in ('L', 'RGB', 'RGBA'): im = im.convert('RGB') im.thumbnail((width, height), Image.ANTIALIAS) thumbnail_file = StringIO() im.save(thumbnail_file, 'JPEG') thumbnail_file.seek(0) return thumbnail_file
0
0
0
0
1
0
I want to create a small math solver application in wpf or silverlight that shows working. Something similiar to what Microsoft Math can do. How do I get those graphics such as the brackets with the ability to stretch vertically based on how many rows are in the equation? Are there any library that contain these graphics and displaying the steps for .net?
0
0
0
0
1
0
i'm trying to make a function that use % operator in objective c my function is: -(void) image1:(UIImageView *)img1 image10:(UIImageView *)img10 image100:(UIImageView *)img100 score:(NSInteger *)sc { NSInteger* s100,s10,s1; s100 = sc % 100; s10 = (sc - s100 * 100) % 10; s1 = (sc - sc % 10); NSLog(@"%d",s1); } but i got errors.. can you guide me to some solution
0
0
0
0
1
0
How can I identify and remove those four RED points drawn in image Those four points make that polygon a concave polygon that’s why I want to remove it. My goal is to convert concave polygon to convex by removing this kind of point by identifying and removing those points. Is there any way to identify and remove these kind of points?
0
0
0
0
1
0
I need to use the Stanford Parser in a web service. As SentenceParser loads a big object, I will make sure it is a singleton, but in this case, is it thread safe (no according to http://nlp.stanford.edu/software/parser-faq.shtml). How else would it be done efficiently? One option is locking the object while being used. Any idea how the people at Stanford are doing this for http://nlp.stanford.edu:8080/parser/ ?
0
1
0
0
0
0
I have a bunch of points in a rectangular x/y space which I would like to project onto a sphere. As in, I am trying to write this function: function point_on_sphere(2dx:Number, 2dy:Number) : Vector3D { //magic return new Vector3D(3dx, 3dy, 3dz); } I have been trying to first plot the points on to a cylinder and then map those points to a sphere as directed by this wikipedia page. However, those formulas assume a constant z=0, which doesn't really do what I want. I'm using actionscript 3 / flex, but any pseudo code or pushes in the right direction would be greatly appreciated. Just to clarify: I'm not trying to apply a texture to a sphere object, but rather to place objects along an imaginary sphere.
0
0
0
0
1
0
I am trying to solve a problem that involves comparing large numbers of word sets , each of which contains a large, ordered number of words from a set of words (totaling around 600+, very high dimensionality!) for similarity and then clustering them into distinct groupings. The solution needs to be as unsupervised as possible. The data looks like [Apple, Banana, Orange...] [Apple, Banana, Grape...] [Jelly, Anise, Orange...] [Strawberry, Banana, Orange...] ...etc The order of the words in each set matters ([Apple, Banana, Orange] is distinct from [Apple, Orange, Banana] The approach I have been using so far has been to use Levenshtein distance (limited by a distance threshold) as a metric calculated in a Python script with each word being the unique identifier, generate a similarity matrix from the distances, and throwing that matrix into k-Mediods in KNIME for the groupings. My questions are: Is Levenshtein the most appropriate distance metric to use for this problem? Is mean/medoid prototype clustering the best way to go about the groupings? I haven't yet put much thought into validating the choice for 'k' in the clustering. Would evaluating an SSE curve of the clustering be the best way to go about this? Are there any flaws in my methodology? As an extension to the solution in the future, given training data, would anyone happen to have any ideas for going about assigning probabilities to cluster assignments? For example, set 1 has a 80% chance of being in cluster 1, etc. I hope my questions don't seem too silly or the answers painfully obvious, I'm relatively new to data mining. Thanks!
0
1
0
0
0
0
My application has some parabolic partial differential equations...which are inter-related and use some variables which the user inputs via a UI from a desktop application. Can you guide me through as to which software or library or a particular language would serve the best purpose for the above?
0
0
0
0
1
0
Calculating form has options and based on what the client enters determines what products load in a sidebar. Products are given a quantity that directly reflects that value of the option. So now per product there is a Total Price, Total Duration and Total Number of Dives as seen here. num1=Number(document.getElementById('product_quantity_' + productid).value); num2=Number(document.getElementById('product_price_' + productid).value); nums=num1*num2; document.getElementById('product_price_total_' + productid).value = nums; num1=Number(document.getElementById('product_quantity_' + productid).value); num2=Number(document.getElementById('product_duration_' + productid).value); nums=num1*num2; document.getElementById('product_duration_total_' + productid).value = nums; num1=Number(document.getElementById('product_quantity_' + productid).value); num2=Number(document.getElementById('product_dives_' + productid).value); nums=num1*num2; document.getElementById('product_dives_total_' + productid).value = nums; num1=Number(document.getElementById('product_quantity_' + productid).value); num2=Number(document.getElementById('product_hire_' + productid).value); nums=num1*num2; document.getElementById('product_hire_total_' + productid).value = nums; So now we need a script that gives us the Grand Total Price of all of the -- 'product_price_total_' + productid).value -- and another for Grand Total Duration, and a third for Grand Total Dives etc.. etc... Not sure how but a few ideas would be an array that added up only fields with a specific alt tag or title tag. Anyone got any ideas. Thanks
0
0
0
0
1
0
I have a "mad lib" scenario in which I want to a) determine the parts of speech of every (or most) words in a sentence b) have the user select alternatives to those words - or replace them computationally with equivalent words I looked at the Stanford parser but its a bit slow ... any suggestions?
0
1
0
0
0
0
Does anyone know if it is possible to find a power spectral density of a signal with gaps in it. For example (in matlab syntax cause that is what I'm familiar with) ta=1:1000; tb=1200:3000; t=[ta tb]; % this is the timebase signal=randn(size(t)); this is a signal figure(101) plot(t,signal,'.') I'd like to be able to determine frequencies on a longer time base that just the individual sections of data. Obviously I could just take the PSD of individual sections but that will limit the lowest frequency. I could interpolate the data, but this would colour the PSD. Any thoughts would be much appreciated.
0
0
0
0
1
0
ROT13 has the nice property of being an involution for an A-Z alphabet (26 letters), that is to say: ROT13(ROT13(string-A-to-Z)) = string-A-to-Z ; What is a simple cipher function for an alphabet with an odd number of symbols that has the same property? Obviously, a straight-up substitution won't work, but I'm looking for something nearly as simple.
0
0
0
0
1
0
First of all, math is not my area. Imagine a problem like this: I have a number of money to spend, say 500, and i need to spend them on a fixed number of days, say 20. I have a fixed maximum of money to spend per day, like 50. I don't need to spend money on a day. Now i need to know how to calculate the total number of money I have to spend each day to get a spending curve like the following: My goal is a function that takes a number of money and a number of days, and returns an tuple with day number and ammount of money for that day. I know i need to use logarithms of some type, and i've tried pretty much everything that my brain can handle. I've been looking at wolfram mathworld and this formula: y = a + b ln x But it does not really help me. An hint or example in PHP, Python or C# would be great, but any language will do. PLEASE let me know if you need any more information or if the question is vague, I really want to solve this. Thank you!
0
0
0
0
1
0
I have two points, a and b. I need to calculate the angle between them, so I treat them like vectors. However vector a will always be defined as [0 0 0]. Reading over the MATLAB Newsreader, "Angle between two vectors", three solutions are provided: x1 = 0; y1 = 0; z1 = 0; x2 = 0; y2 = 1; z2 = 0; a = [x1,y1,z1]; b= [x2,y2,z2]; theta = rad2deg(atan2(norm(cross(a,b)),dot(a,b))) theta = rad2deg(acos(dot(a,b))) theta = rad2deg(atan2(x1*y2-x2*y1,x1*x2+y1*y2)) However as acos has accuracy problems as theta nears zero, yet out of the three equations, only acos provides the correct solution. Should I continue to use acos or is there a better solution?
0
0
0
0
1
0
I have the following vexing problem. I have implemented the following function: function bool less(nat x, nat y) { if (y<>0) then if (x<>0) then return less(x-1,y-1); else return true; end; else return false; end; end; How can I show that for all x,y the following less(x,y) and less(y,x) are not possible at the same time? Bye
0
0
0
0
1
0
We are given "N" pairs of parentheses, ie "N" opening parenthesis "(" and "N" closing parenthesis ")". We are asked to find the number of ways to make Sequence of 2N parentheses that are GOOD, i.e. we dont close before opening. I need to find a definition for GOOD Sequences that i can use for the rest of the problem.
0
0
0
0
1
0
My feature vector has both continuous (or widely ranging) and binary components. If I simply use Euclidean distance, the continuous components will have a much greater impact: Representing symmetric vs. asymmetric as 0 and 1 and some less important ratio ranging from 0 to 100, changing from symmetric to asymmetric has a tiny distance impact compared to changing the ratio by 25. I can add more weight to the symmetry (by making it 0 or 100 for example), but is there a better way to do this?
0
0
0
1
0
0
I've been experimenting with genetic algorithms as of late and now I'd like to build mathematical expressions out of the genomes (For easy talk, its to find an expression that matches a certain outcome). I have genomes consisting of genes which are represented by bytes, One genome can look like this: {12, 127, 82, 35, 95, 223, 85, 4, 213, 228}. The length is predefined (although it must fall in a certain range), neither is the form it takes. That is, any entry can take any byte value. Now the trick is to translate this to mathematical expressions. It's fairly easy to determine basic expressions, for example: Pick the first 2 values and treat them as products, pick the 3rd value and pick it as an operator ( +, -, *, /, ^ , mod ), pick the 4th value as a product and pick the 5th value as an operator again working over the result of the 3rd operator over the first 2 products. (or just handle it as an postfix expression) The complexity rises when you start allowing priority rules. Now when for example the entry under index 2 represents a '(', your bound to have a ')' somewhere further on except for entry 3, but not necessarily entry 4 Of course the same goes for many things, you can't end up with an operator at the end, you can't end up with a loose number etc. Now i can make a HUGE switch statement (for example) taking in all the possible possibilities but this will make the code unreadable. I was hoping if someone out there knows a good strategy of how to take this one on. Thanks in advance! ** EDIT ** On request: The goal I'm trying to achieve is to make an application which can resolve a function for a set of numbers. As for the example I've given in the comment below: {4, 11, 30} and it might come up with the function (X ^ 3) + X
0
1
0
0
1
0
When I listen to orientation event in an android app, I get a SensorEvent, which contains 3 floats - azimuth, pitch, and roll in relation to the real-world's axis. Now say I am building an app like labyrinth, but I don't want to force the user the be over the phone and hold the phone such that the xy plane is parallel to the ground. Instead I want to be able to allow the user to hold the phone as they wish, laying down or, perhaps, sitting down and holding the phone at an angle. In other words, I need to calibrate the phone in accordance with the user's preference. How can I do that? Also note that I believe that my answer has to do with getRotationMatrix and getOrientation, but I am not sure how! Please help! I've been stuck at this for hours.
0
0
0
0
1
0
I need to project a 3D object onto a sphere's surface (uhm.. like casting a shadow). AFAIR this should be possible with a projection matrix. If the "shadow receiver" was a plane, then my projection matrix would be a 3D to 2D-plane projection, but my receiver in this case is a 3D spherical surface. So given sphere1(centerpoint,radius),sphere2(othercenter,otherradius) and an eyepoint how can I compute a matrix that projects all points from sphere2 onto sphere1 (like casting a shadow).
0
0
0
0
1
0
I'm trying to measure the agreement between two different systems of classification (one of them based on machine-learning algorithms, and the other based on human ground-truthing), and I'm looking for input from someone who's implemented a similar sort of system. The classification schema allows each item to be classified into multiple different nodes in a category taxonomy, where each classification carries a weight coefficient. For example, if some item can be classified into four different taxonomy nodes, the result might look like this for the algorithmic and ground-truth classifiers: ALGO TRUTH CATEGORY A: 0.35 0.50 CATEGORY B: 0.30 0.30 CATEGORY C: 0.25 0.15 CATEGORY D: 0.10 0.05 The weights will always add up to exactly 1.0, for all selected category nodes (of which there are about 200 in the classification taxonomy). In the example above, it's important to note that both lists agree about rank ordering (ABCD), so they should be scored as being in strong agreement with one another (even though there are some differences in the weights assigned to each category. By contrast, in the next example, the two classifications are in complete disagreement with respect to rank-order: ALGO TRUTH CATEGORY A: 0.40 0.10 CATEGORY B: 0.35 0.15 CATEGORY C: 0.15 0.35 CATEGORY D: 0.10 0.40 So a result like this should get a very low score. One final example demonstrates a common case where the human-generated ground-truth contains duplicate weight values: ALGO TRUTH CATEGORY A: 0.40 0.50 CATEGORY B: 0.35 0.50 CATEGORY C: 0.15 0.00 CATEGORY D: 0.10 0.00 So it's important that the algorithm allows lists without perfect rank ordering (since the ground truth could be validly interpreted as ABCD, ABDC, BACD, or BADC) Stuff I've tried so far: Root Mean Squared Error (RMSE): Very problematic. It doesn't account for rank-order agreement, which means that gross disagreements between categories at the top of the list are swept under the rug by agreement about categories at the bottom of the list. Spearman's Rank Correlation: Although it accounts for differences in rank, it gives equal weight to rank agreements at the top of the list and those at the bottom of the list. I don't really care much about low-level discrepancies, as long as the high-level discrepancies contribute to the error metric. It also doesn't handle cases where multiple categories can have tie-value ranks. Kendall Tau Rank Correlation Coefficient: Has the same basic properties and limitations as Spearman's Rank Correlation, as far as I can tell. I've been thinking about rolling my own ad-hoc metrics, but I'm no mathematician, so I'd be suspicious of whether my own little metric would provide much rigorous value. If there's some standard methodology for this kind of thing, I'd rather use that. Any ideas?
0
0
0
0
1
0
Whats the best method to use the words itself as the features in any machine learning algorithm ? The problem I have to extract word related feature from a particular paragraph. Should I use the index in the dictionary as the numerical feature ? If so, how will I normalize these ? In general, How are words itself used as features in NLP ?
0
1
0
1
0
0
So we can use isObservable to work with some systems but I wonder If we can make tham show staps or do something like that. Is that possible?
0
0
0
0
1
0
I have a spaceship in a 3D environnement. I drew a B-Spline curve using control points (converted to a Bezier curve to be able to draw it). Each time the draw event is called, the ship is at the point (0,0,0) and is translated to the next coordinate on the curve. Now, before doing this translation, I would need to make a rotation so that the ship's orientation is along the curve's tangent at that point. I'm able to approximate the tangent by finding a point on the curve that is near the current one by doing this. I use OpenGL in C++ float mDifference[1][3] = {nearPoint[0][0] - currentPosition[0][0], nearPoint[0][1] - currentPosition[0][1], nearPoint[0][2] - currentPosition[0][2]}; float norm = sqrt(mDifference[0][0] * mDifference[0][0] + mDifference[0][1] * mDifference[0][1] + mDifference[0][2] * mDifference[0][2]); float tangent[1][3] = { mDifference[0][0] / norm, mDifference[0][1] / norm, mDifference[0][2] / norm}; //tangent = rotationVector? spacecraftTransformGroup->setRotationVector(tangent[0][0],tangent[0][1],tangent[0][2]); I think the rotation vector is the tangent, but can't find the angle needed to rotate the ship. How can I rotate the ship to align it with the tangent?
0
0
0
0
1
0
I'm coding an abstract strategy game with C# & XNA. As for the AI, I'm currently using Negascout and a depth of 5. The following is the description of the game: The game consists of a board of 6x7 hexagonal locations, 42 hexagonal tiles, and 6 pieces (1 king & 5 pawns) for each player (max 2 players). During the first phase of the game, the players alternately place a random tile on an empty location of the board. Each tile can have a maximum of 6 arrows pointing at the edges. Some arrows can be double-pointed. The arrows mean the direction/s of movement from that tile. A double-pointed arrow makes a piece move/jump 2 locations if there's a valid location. The players are not allowed to place tiles in their opponent's row if there are still empty locations left on the board. Once this phase is complete, the next player in turn places his king on any one of the 6 tiles of the row nearest to him. Next, the movement of the pieces commences. Pieces are moved according to the arrows on the tiles. The game is won by capturing or blocking the king. Ok, so now to my move generation function. Tile placement stage a) Place a tile on the nearest row. The tile is rotated to find the optimal rotation. b) Once the nearest row is full, place a tile on an empty location that is surrounded by locations on all sides (ie no edge of board). Rotate the tile to find the optimal rotation. c) If no locations are found, add all remaining empty locations, trying to find the optimal rotation. King placement stage a) Locate the location with the best tile and place the king there. b) Place the remaining pawns on the remaining empty locations on the row. Movement stage a) If king is attacked, try to attack the attacking piece if that piece is not defended. b) Add moves for all player's pieces that are being attacked. c) Add all opponent pieces that the player can attack. d) Add all locations player can move to. Now to the evaluation function. Tile placement stage score = No. of tiles current player placed so far + current player's tiles on the nearest row - no. of tiles opponent placed so far - opponent's tiles on the furthest row (nearest to the opponent). King placement stage score = current player's tiles on the nearest row - opponent's tiles on the furthest row (nearest to the opponent). Movement stage score = current player's pieces' value - opponent's pieces' value. The weighting of the tiles is 100 for every valid location an arrow points to. The weighting of the pieces is as follows: piece value = piece type (king = 10000, pawn = 1000) + mobility + defended - attacked - enprise - blocked where: mobilty = no. of locations node can move to (free or occupied by the opponent) * 1000 defended = no. of current player pieces surrounding this piece that can actually move to this location * 1000 attacked = no. of opponent pieces surrounding this piece that can actually move to this location * 1000 blocked = (king = -10000, pawn = -1000) piece cannot move because all arrows point to invalid locations and the piece has no chance of moving again in this game. Quite long, but here come my problems: When placing tiles, the AI sometimes places a tile using the wrong rotation (ie. places a tile in location where the arrows point to no valid locations). Sometimes this occurs in his 'home' row. When moving pieces, the AI is ignoring king safety. Moves mostly the king and is captured in about 4-6 moves. Anybody, especially with chess AI experience, has ideas and suggestions on how to improve my AI, in particular my move generation and evaluation functions? Thanks Ivan btw... If anyone is interested in trying out the mail, just let me know and I'll upload a setup on my website.
0
1
0
0
0
0
A graphic of this problem is here: http://dl.dropbox.com/u/13390614/Question2.jpg Take an axis aligned ellipse with a fixed minor axis, and stretch the ellipse along its major axis till the ellipse's perimiter coincides with a point (A in the graphic). What is the new major axis length? I can solve this problem when both axis are to be modified, but am stumped when only one axis is modified. Any insights would be appreciated. Gary
0
0
0
0
1
0
I have two arrays of points: double[] minus and double[] plus, e.g.: double[] minus = new[] { 24.043414306636713, 26.521399902043807, 23.049167719142361, 24.473177606966754, 18.238281854192408, }; double[] plus = new[] { 8.31219054269323, 9.5909890877229582, 11.066525870449567, 22.769068312057193, 24.733540360065991, }; I need to plot 2 diagrams basing on this number and determine their positions relatively to each other: are there an intersection and which of them is under another? How can I do that? TIA (please feel free to retag the question or change the topic, I'm not sure in proper math terminology used) Edit: Here's an Excel diagram: It's easy to determine which is above and which is under. How to determine that red (plus) has an intersection with blue (minus)? Using maybe LINQ?
0
0
0
0
1
0
I'm wondering how people test artificial intelligence algorithms in an automated fashion. One example would be for the Turing Test - say there were a number of submissions for a contest. Is there any conceivable way to score candidates in an automated fashion - other than just having humans test them out. I've also seen some data sets (obscured images of numbers/letters, groups of photos, etc) that can be fed in and learned over time. What good resources are out there for this. One challenge I see: you don't want an algorithm that tailors itself to the test data over time, since you are trying to see how well it does in the general case. Are there any techniques to ensure it doesn't do this? Such as giving it a random test each time, or averaging its results over a bunch of random tests. Basically, given a bunch of algorithms, I want some automated process to feed it data and see how well it "learned" it or can predict new stuff it hasn't seen yet.
0
1
0
0
0
0
What I'm trying to do is find an algorithm that can I can implement to generate 'intelligent' suggestions to people, by comparing messages they send to messages sent by their peers. For example, Person A sends a message to Person B talking about Obj1. If Person C sends a message to Person D about Obj1, it will notice they are talking about the same things, and may suggest Person A talks to person C. I have implemented collecting the statistics to capture the mentions people have in common but do not know which algorithm to use to analyse this. Any suggestions? (I hope this makes enough sense)
0
1
0
0
0
0
I'm starting to study machine learning and bayesian inference applied to computer vision and affective computing. If I understand right, there is a big discussion between classical IA, ontology, semantic web researchers and machine learning and bayesian guys I think it is usually referred as strong AI vs weak AI related also to philosophical issues like functional psychology (brain as black box set) and cognitive psychology (theory of mind, mirror neuron), but this is not the point in a programming forum like this. I'd like to understand the differences between the two points of view. Ideally, answers will reference examples and academic papers where one approach get good results and the other fails. I am also interested in the historical trends: why approaches fell out of favour and a newer approaches began to rise up. For example, I know that Bayesian inference is computationally intractable, problem in NP, and that's why for a long time probabilistic models was not favoured in information technology world. However, they've began to rise up in econometrics.
0
1
0
1
0
0
I have a table of people's Full Names. I'd like users to be able to search it by partial names and misspelled names. So a search for 'Andrew' should also return 'Andrea', etc. I thought FULLTEXT search was the answer but it doesn't seem to work any differently than if I'd searched using ... LIKE '%Andrew%'. Is there a function or feature in MySQL that will search based on string similarity? Or will I have to roll my own on the PHP end using levenshtein() or something similar? Given This Table: CREATE TABLE `people` ( `FullName` varchar(30) default NULL, `namesID` int(11) NOT NULL auto_increment, PRIMARY KEY (`namesID`), FULLTEXT KEY `fulltext_FullName` (`FullName`) ) ENGINE=MyISAM AUTO_INCREMENT=15 DEFAULT CHARSET=utf8; LOCK TABLES `people` WRITE; /*!40000 ALTER TABLE `people` DISABLE KEYS */; INSERT INTO `people` (`FullName`,`namesID`) VALUES ('Mark Peters',1), ('Bob Jackson',2), ('Steve Kipp',3), ('Joe Runty',4), ('Tina Mardell',5), ('Tim Havers',6), ('Rich Beckett',7), ('Mary Dalson',8), ('Maria Grento',9), ('Michael Colt',10), ('Andrew Peters',11), ('Andre Bison',12), ('Andrea Masters',13), ('Marla Tool',14); /*!40000 ALTER TABLE `people` ENABLE KEYS */; UNLOCK TABLES; And This Query: SELECT * FROM people WHERE MATCH(FullName) AGAINST('Andrew'); I only get: FullName namesID Andrew Peters 11 When I'd like to also get: Andre Bison Andrea Masters etc.
0
1
0
0
0
0
i am working on my final year project "OPINION MINING" of mobile set. i have gone through bin liu's site and hav refered nearly 50 Different papers but all are suggesting different methods and i am not finding a clear cut solution as to how to proceed with opinion mining i.e. steps. Double propogation method suggested by bing liu is very hard to proceed (as i have to use c# strictly) and the dependency parser "Minipar" which he uses in that method happens to be in .net 2003 m using vs 2008. can anybody suggest me a simple nlp based method to do opinion mining where i want to do tasks like: 1.feature extraction 2.opinion lexicon creation and opinion extraction 3.opinion orientation 4.summerization 5.searching for opinions please help me guys i badly require ur help especially from anybody working in this area... thanx. amey.
0
1
0
0
0
0
I am trying to create a simple simulation program of SIR-epidemics model in java. Basically, SIR is defined by a system of three differential equations: S'(t) = - l(t) * S(t) I'(t) = l(t) * S(t) - g(t) * I(t) R'(t) = g(t) * I(t) S - susceptible people, I - infected people, R - recovered people. l(t) = [c * x * I(t)] / N(T) c - number of contacts, x - infectiveness (probability to get sick after contact with sick person), N(t) - total population (which is constant). How can I solve such differential equations in Java? I don't think I know any useful way to do that, so my implementation produces rubbish. public class Main { public static void main(String[] args) { int tppl = 100; double sppl = 1; double hppl = 99; double rppl = 0; int numContacts = 50; double infectiveness = 0.5; double lamda = 0; double duration = 0.5; double gamma = 1 / duration; for (int i = 0; i < 40; i++) { lamda = (numContacts * infectiveness * sppl) / tppl; hppl = hppl - lamda * hppl; sppl = sppl + lamda * hppl - gamma * sppl; rppl = rppl + gamma * sppl; System.out.println (i + " " + tppl + " " + hppl + " " + sppl + " " + rppl); } } } I would greatly appreciate any help, many thanks in advance!
0
0
0
0
1
0
for a 3d imaging software i am coding: I need to define an ellipsoid E, which can have any radii, centers and rotations in space the user interface allows the user to control 3 ellipses, which are "slices" of the ellipsoid (red,green,blue in the image) ,and are parallel (by definition) to the main Cartesian planes (x-y, y-z. x-z) these 3 ellipses are part of, and define, the whole ellipsoid each slice can be dragged, resized or rotated in space and each slice is fully defined: it's center's 3d position in space, it's 2 radiuses, it's distance from the axis planes. each change should, obviously, affect the parameters of the ellipsoid E, and the other 2 derived ellipses. i need the equation to re-calculate ellipsoid E based on the changes made to a slice (The preferred type of equation for the ellipsoid should make it easy to derive the X-Y ellipse cuts (variable z)) any ideas? thanx in advance Saar
0
0
0
0
1
0
Hej guys, I was wondering if you know any well working Math or Calculation engines written in Objective-C? Found a graphing one using CorePlot already.... Thanks for your help! :)
0
0
0
0
1
0
This quation is mostly a result of this thread: Differential Equations in Java. Basically, I've tried to follow Jason S. advise and to implement numerical solutions to differential equations via Runge-Kutta method (RK4). Hello everyone, I am trying to create a simple simulation program of SIR-epidemics model in java. Basically, SIR is defined by a system of three differential equations: S'(t) = - lamda(t) * S(t) I'(t) = lamda(t) * S(t) - gamma(t) * I(t) R'(t) = gamma(t) * I(t) S - susceptible people, I - infected people, R - recovered people. lamda(t) = [c * x * I(t)] / N(T) c - number of contacts, x - infectiveness (probability to get sick after contact with sick person), N(t) - total population (which is constant). gamma(t) = 1 / duration of illness (constant) After first not very successful attempt, I've tried to solve this equations with Runge-KUtta, and this attempt resulting in the following code: package test; public class Main { public static void main(String[] args) { double[] S = new double[N+1]; double[] I = new double[N+1]; double[] R = new double[N+1]; S[0] = 99; I[0] = 1; R[0] = 0; int steps = 100; double h = 1.0 / steps; double k1, k2, k3, k4; double x, y; double m, n; double k, l; for (int i = 0; i < 100; i++) { y = 0; for (int j = 0; j < steps; j++) { x = j * h; k1 = h * dSdt(x, y, S[j], I[j]); k2 = h * dSdt(x+h/2, y +k1/2, S[j], I[j]); k3 = h * dSdt(x+h/2, y+k2/2, S[j], I[j]); k4 = h * dSdt(x+h, y + k3, S[j], I[j]); y += k1/6+k2/3+k3/3+k4/6; } S[i+1] = S[i] + y; n = 0; for (int j = 0; j < steps; j++) { m = j * h; k1 = h * dIdt(m, n, S[j], I[j]); k2 = h * dIdt(m+h/2, n +k1/2, S[j], I[j]); k3 = h * dIdt(m+h/2, n+k2/2, S[j], I[j]); k4 = h * dIdt(m+h, n + k3, S[j], I[j]); n += k1/6+k2/3+k3/3+k4/6; } I[i+1] = I[0] + n; l = 0; for (int j = 0; j < steps; j++) { k = j * h; k1 = h * dRdt(k, l, I[j]); k2 = h * dRdt(k+h/2, l +k1/2, I[j]); k3 = h * dRdt(k+h/2, l+k2/2, I[j]); k4 = h * dRdt(k+h, l + k3, I[j]); l += k1/6+k2/3+k3/3+k4/6; } R[i+1] = R[i] + l; } for (int i = 0; i < 100; i ++) { System.out.println(S[i] + " " + I[i] + " " + R[i]); } } public static double dSdt(double x, double y, double s, double i) { return (- c * x * i / N) * s; } public static double dIdt(double x, double y, double s, double i) { return (c * x * i / N) * s - g * i; } public static double dRdt(double x, double y, double i) { return g*i; } private static int N = 100; private static int c = 5; private static double x = 0.5; private static double g = (double) 1 / x; } This does not seem to work, because number of sick people (I) should first increse, and then dicrease to about 0, and number of recovered people should strictly increase. Total number of sick + healthy + recovered should be 100, but my code produces some strange results: 99.0 1.0 0.0 98.9997525 0.9802475 0.03960495 98.99877716805084 0.9613703819491656 0.09843730763898331 98.99661215494893 0.9433326554629141 0.1761363183872249 98.99281287394908 0.9261002702516101 0.2723573345404987 98.98695085435723 0.9096410034385773 0.3867711707625441 98.97861266355956 0.8939243545756241 0.5190634940761019 98.96739889250752 0.8789214477384787 0.6689342463444292 98.95292320009872 0.8646049401404658 0.8360970974155659 98.93481141227473 0.8509489367528628 1.0202789272217598 98.91270067200323 0.8379289104653137 1.22121933523726 98.8862386366277 0.8255216273600343 1.438670175799961 98.8550827193552 0.8137050767097959 1.672395117896858 I cannot find a mistake, please advise! Many thanks in advance!
0
0
0
0
1
0
Σ from i=1 to n of(n)(n+1)/2 What is the upper limit of computation for a give n? is it O(n^3) O(n^2)? Example: n=1 , sum =1 n=2 , sum= 1+ 1+2 , sum = 4 n=3, sum= 1+1+2+1+2+3, sum = 10 n=4, sum = 1 + 1+2 + 1+2+3 + 1+2+3+4 = 20 n= 5, sum = 1+ 1+2 +1+2+3 +1+2+3+4 + 1+2+3+4+5 , sum = 35 ... n=10, sum = ..... , sum = 220 etc, so what is the upper bound of this computation as a function of N? is it : O(n^3)?
0
0
0
0
1
0
I am really in the deep end on what the heck I am doing.. all I know is what I need to get done.. how to get there.. i'm not sure. *Edit to make clearer: We are dealing with two rotational values here that are increasing/decreasing at the same speed and are both shifted off by 1/2PI. Start point/End point 1 is 2PI and PI1/2 Start point/End point 2 is 1/2PI and PI I need to create an equation that maps rotational value 2 to rotational value 1 such that any value in that rotational section will give me the value of the other rotational object. Example: rot 2 at 1/2PI (insert math here) = 2PI (the value at rot 1) I'm sorry if this is a terribly easy question and i'm just stupid, but I honestly have no idea how to solve it. Thanks.
0
0
0
0
1
0
Alright, so I'm still trying to make my players movements relative to the camera. I got a good answer here But he ends it with: s(Jx x̂ + Jy ŷ) So how can I turn that equation into a x and y?
0
0
0
0
1
0
PHP has a function range('a','z') which prints the English alphabet a, b, c, d, etc. Is there a similar function for other alphabets? maybe a function that accepts the language as a parameter
0
1
0
0
0
0
I need to know how to determine the frequency count of the sum:= sum+1 statement in the following program: sum:=0 for i:=1 to n do for j:=1 to i do for k:=1 to j do sum:= sum+1 end<br/> end end I would also like to know how, in general, to determine the frequency count of all algorithms not just this one specifically.
0
0
0
0
1
0
** STILL NOT WORKING ** I am using below formula to move the ball circular, where accelX and accelY are the values from accelerometer, it is working fine. But the problem in this code is mRadius (I fixed its value to 50), i need to change mRadius according to accelerometer values and also i need bouncing effect when it touches the track. Currently i am developing code by assuming only one ball is on the board. float degrees = -atan2(accelX, accelY); int x = cCentrePoint.x + mRadius * cos(degrees); int y = cCentrePoint.y + mRadius * sin(degrees); Here is the snap of the game i want to develop: Balls Game http://iphront.com/wp-content/uploads/2009/12/bdece528ea334033.jpg.jpg Updated: I am sending the updated code... mRadius = 5; mRange = NSMakeRange(0,60); -(void) updateBall: (UIAccelerationValue) accelX withY:(UIAccelerationValue)accelY { float degrees = -atan2(accelX, accelY); int x = cCentrePoint.x + mRadius * cos(degrees); int y = cCentrePoint.y + mRadius * sin(degrees); //self.targetRect is rect of ball Object self.targetRect = CGRectMake(newX, newY, 8, 9); self.currentRect = self.targetRect; static NSDate *lastDrawTime; if(lastDrawTime!=nil) { NSTimeInterval secondsSinceLastDraw = -([lastDrawTime timeIntervalSinceNow]); ballXVelocity = ballXVelocity + (accelX * secondsSinceLastDraw) * [self isTouchedTrack:mRadius andRange:mRange]; ballYVelocity = ballYVelocity + -(accelY * secondsSinceLastDraw) * [self isTouchedTrack:mRadius andRange:mRange]; distXTravelled = distXTravelled + secondsSinceLastDraw * ballXVelocity * 50; distYTravelled = distYTravelled + secondsSinceLastDraw * ballYVelocity * 50; //Updating the ball rect CGRect temp = self.targetRect; temp.origin.x += distXTravelled; temp.origin.y += distYTravelled; //calculating new radius after updating ball position int radius = (temp.origin.x - cCentrePoint.x) / cos(degreesToRadians(degrees)); if( !NSLocationInRange(abs(radius),mRange)) { //Colided with the tracks...Need a better logic here ballXVelocity = -ballXVelocity; } else { // Need a better logic here self.targetRect = temp; } } [lastDrawTime release]; lastDrawTime = [ [NSDate alloc] init]; } In the above code i have initialized mRadius and mRange(indicate track) to some constant for testing, i am not getting the moving of the ball as i expected( bouncing effect when Collided with track ) with respect to accelerometer. Help me to recognize where i went wrong or send some code snippets or links which does the similar job. I am searching for better logic than my code, if you found share with me.
0
0
0
0
1
0
How would I create a rotation matrix that rotates X by a, Y by b, and Z by c? I need to formulas, unless you're using the ardor3d api's functions/methods. Matrix is set up like this xx, xy, xz, yx, yy, yz, zx, zy, zz A Quaternion is fine too.
0
0
0
0
1
0
So we have some function like (pow(e,(-a*x)))/(sqrt(x)) where a, e are const floats. we have some float eps=pow (10,(-4)). We need to find out starting from which x integral of that function from that x to infinety is less than eps? We can not use functions for special default integration function just standart math like operators. point is to achive max evaluetion speed.
0
0
0
0
1
0