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
So I had a system #for given koefs k:=3; n:=3; #let us solve system: koefSolution:= solve({ sum(a[i], i = 0 .. k) = 0, sum(a[i], i = 0 .. k)-(sum(b[i], i = 0 .. k)) = 0, sum(i^n*a[i], i = 0 .. k)-(sum(i^(n-1)*b[i], i = 0 .. k)) = 0 }); So I have a vector like koefSolution := { a[0] = 7*a[2]+26*a[3]-b[1]-4*b[2]-9*b[3], a[1] = -8*a[2]-27*a[3]+b[1]+4*b[2]+9*b[3], a[2] = a[2], a[3] = a[3], b[0] = -b[1]-b[2]-b[3], b[1] = b[1], b[2] = b[2], b[3] = b[3]} I have a[0] so I try solve({koefSolution, a[0] = 1}); why it does not solve my system for given a[0]? ( main point here is to fill koefSolution with given a[] and b[] and optimize.)
0
0
0
0
1
0
I have a set of numbers produced using the following formula with integers 0 < x < a. f(x) = f(x-1)^2 % a For example starting at 2 with a = 649. {2, 4, 16, 256, 636, 169, 5, 25, 649, 576, 137, ...} I am after a subset of these numbers that when multiplied together equals 1 mod N. I believe this problem by itself to be NP-complete (based on similaries to Subset-Sum problem). However starting with any integer (x) gives the same solution pattern. Eg. a = 649 {2, 4, 16, 256, 636, 169, 5, 25, 649, 576, 137, ...} = 16 * 5 * 576 = 1 % 649 {3, 9, 81, 71, 498, 86, 257, 500, 135, 53, 213, ...} = 81 * 257 * 53 = 1 % 649 {4, 16, 256, 636, 169, 5, 25, 649, 576, 137, 597, ...} = 256 * 25 * 137 = 1 % 649 I am wondering if this additional fact makes this problem solvable faster? Or if anyone has run into this problem previously or has any advice?
0
0
0
0
1
0
Given an integer I would like to produce a unique floating point number in the interval [0,1]. (this number will be used as id). The problem I found with all functions I have thought about, is that they encounter duplicates before running out of integer values. For example if f(a:int):float = 0.a then f(16000) = 0.16 and f(16001) = 0.16001. But since it is floating point, 0.16 and 0.16001 may be represented the same. In other words, I need a function that produce not only unique numbers, but also numbers that are represented uniquely (at least forthe C++ integer domain). I know the answer is dependent on the size of integer and floating point in a specific environment, but if you can give an example for specific sizes it will still be helpful.
0
0
0
0
1
0
Previously Google launched an application that can search twitter message OVER Time like in news timeline. But it seems it now can only provide real time (current) message index, not the old and all tweets in history. I want to do research on tweets, but do not know where to download or access to such data based on timeline or geography or demographic or topic list. Thank you in advance.
0
1
0
0
0
0
Here is a function I would like to write but am unable to do so. Even if you don't / can't give a solution I would be grateful for tips. For example, I know that there is a correlation between the ordered represantions of the sum of an integer and ordered set partitions but that alone does not help me in finding the solution. So here is the description of the function I need: The Task Create an efficient* function List<int[]> createOrderedPartitions(int n_1, int n_2,..., int n_k) that returns a list of arrays of all set partions of the set {0,...,n_1+n_2+...+n_k-1} in number of arguments blocks of size (in this order) n_1,n_2,...,n_k (e.g. n_1=2, n_2=1, n_3=1 -> ({0,1},{3},{2}),...). Here is a usage example: int[] partition = createOrderedPartitions(2,1,1).get(0); partition[0]; // -> 0 partition[1]; // -> 1 partition[2]; // -> 3 partition[3]; // -> 2 Note that the number of elements in the list is (n_1+n_2+...+n_n choose n_1) * (n_2+n_3+...+n_n choose n_2) * ... * (n_k choose n_k). Also, createOrderedPartitions(1,1,1) would create the permutations of {0,1,2} and thus there would be 3! = 6 elements in the list. * by efficient I mean that you should not initially create a bigger list like all partitions and then filter out results. You should do it directly. Extra Requirements If an argument is 0 treat it as if it was not there, e.g. createOrderedPartitions(2,0,1,1) should yield the same result as createOrderedPartitions(2,1,1). But at least one argument must not be 0. Of course all arguments must be >= 0. Remarks The provided pseudo code is quasi Java but the language of the solution doesn't matter. In fact, as long as the solution is fairly general and can be reproduced in other languages it is ideal. Actually, even better would be a return type of List<Tuple<Set>> (e.g. when creating such a function in Python). However, then the arguments wich have a value of 0 must not be ignored. createOrderedPartitions(2,0,2) would then create [({0,1},{},{2,3}),({0,2},{},{1,3}),({0,3},{},{1,2}),({1,2},{},{0,3}),...] Background I need this function to make my mastermind-variation bot more efficient and most of all the code more "beautiful". Take a look at the filterCandidates function in my source code. There are unnecessary / duplicate queries because I'm simply using permutations instead of specifically ordered partitions. Also, I'm just interested in how to write this function. My ideas for (ugly) "solutions" Create the powerset of {0,...,n_1+...+n_k}, filter out the subsets of size n_1, n_2 etc. and create the cartesian product of the n subsets. However this won't actually work because there would be duplicates, e.g. ({1,2},{1})... First choose n_1 of x = {0,...,n_1+n_2+...+n_n-1} and put them in the first set. Then choose n_2 of x without the n_1 chosen elements beforehand and so on. You then get for example ({0,2},{},{1,3},{4}). Of course, every possible combination must be created so ({0,4},{},{1,3},{2}), too, and so on. Seems rather hard to implement but might be possible. Research I guess this goes in the direction I want however I don't see how I can utilize it for my specific scenario. http://rosettacode.org/wiki/Combinations
0
0
0
0
1
0
After implementing Pacman and Snake I'm implementing the next very very classic game: Pong. The implementation is really simple, but I just have one little problem remaining. When one of the paddle (I'm not sure if it is called paddle) is controlled by the computer, I have trouble to position it at the correct position. The ball has a current position, a speed (which for now is constant) and a direction angle. So I could calculate the position where it will hit the side of the computer controlled paddle. And so Icould position the paddle right there. But however in the real game, there is a probability that the computer's paddle will miss the ball. How can I implement this probability? If I only use a probability of lets say 0.5 that the computer's paddle will hit the ball, the problem is solved, but I think it isn't that simple. From the original game I think the probability depends on the distance between the current paddle position and the position the ball will hit the border. Does anybody have any hints how exactly this is calculated?
0
1
0
0
0
0
I have a text file that include data. My text file: young, myopic, no, reduced, no young, myopic, no, normal, soft young, myopic, yes, reduced, no young, myopic, yes, normal, hard young, hyperopia, no, reduced, no young, hyperopia, no, normal, soft young, hyperopia, yes, reduced, no young, hyperopia, yes, normal, hard I read my text file load method %young=1 %myopic=2 %no=3 etc. load iris.txt net = newsom(1,[1 5]); [net,tr] = train(net,1); plotsomplanes(net); Error code: ??? Undefined function or method 'plotsomplanes' for input arguments of type 'network'.
0
0
0
1
0
0
I am looking for research and algorithms on classifying document importance based on the location of a searched keyword in the sentence. I remember seeing interesting papers on this topic before, but now that I need those I cannot find the good ones. Can you please point me to recent or classic works in sentence relevance to a query? Thank you very much! Evgeniy
0
1
0
0
0
0
I have a very large positive integer number (million digits). I need represent it with the smallest possible function, this number is variable, it means, I need an algorithm that generates the smallest possible function to get the given number. Example: For the number 29512665430652752148753480226197736314359272517043832886063884637676943433478020332709411004889 the algorithm must return "9^99". It must be able to analyze numbers and always return a math function that represent the number. Example the number 21847450052839212624230656502990235142567050104912751880812823948662932355202 must return "9^5^16+1".
0
0
0
0
1
0
This is not homework, for I am not a student. This is for my general curiosity. I apologize if I am reinventing the wheel here.The function I seek can be defined as follows (language agnostic): int getPercentageOfA(double moneyA, double workA, double moneyB, double workB) { // Perhaps you may assume that workA == 0 // Compute result return result; } Suppose Alice and Bob want to do business together ... such as ... selling used books. Alice is only interested in investing money in it and nothing else. Bob might invest some money, but he might have no $ available to invest. He will, however, put in the effort in finding a seller, a buyer, and doing maintenance. There are no tools, education, health insurance costs, or other expenses to consider. Both Alice and Bob wish to split the profits "equally" (A different weight like 40/60 for advanced users). Both are entrepreneurs, so they deal with low ROI/wage, and high income alike. There is no fixed wage, minimum wage, fixed ROI, or minimum ROI. They try to find the best deal possible, assume risks and go for it. Now, let's stick with the 50/50 model. If Alice invests $100, Bob invests work, and they will end up with a profit (or loss) of $60, they will split it equally - either both get $30 for their efforts/investments, or Bob ends up owing $30 to Alice. A second possibility: Both Alice and Bob invest 100, then Bob does all the work, and they end up splitting $60 profit. It looks like Alice should get only $15, because $30 of that profit came from Bob's investment and Bob's effort, so Alice shall have none of it, and the other $30 is to be split 50/50. Both of the examples above are trivial even when A and B want to split it 35/65 or what have you. Now it gets more complicated: What if Alice invests $70, and Bob invests $30 + does all of the work. It appears simple: (70,30) = (30,30) + (40,0) ... but, if only we knew how to weigh the two parts relative to each other. Another complicated (I think) example: what if Alice and Bob invest $70 and $30 respectively, and also put in an equal amount of work? I have a few data points: When A and B put in the same amount of work and the same $ - 50/50. When A puts in 100% of the money, and B does 100% of the work - 50/50. When A does all of the work and puts in all of the money - 100 for A / 0 for B (and vice-versa). When A puts in 50% of the money, and B puts in 50% of the money as well as does all of the work - 25 for A, and 75 for B (and vice-versa). If I fix things such that always workA = 0%, workB = 100% of the total work, then getPercentageOfA becomes a function: height z given x and y. The question is - how do you extrapolate this function between these several points? What is this function? If you can cover the cases when workA does not have to be 0% of the total work, and when investment vs work is split as 85/15 or using some other model, then what would the new function be?
0
0
0
0
1
0
I am attempting to locate the nth element of a List in Prolog. Here is the code I am attempting to use: Cells = [OK, _, _, _, _, _] . ... next_safe(_) :- facing(CurrentDirection), delta(CurrentDirection, Delta), in_cell(OldLoc), NewLoc is OldLoc + Delta, nth1(NewLoc, Cells, SafetyIdentifier), SafetyIdentifier = OK . Basically, I am trying to check to see if a given cell is "OK" to move into. Am I missing something?
0
1
0
0
0
0
In this program I am trying to create a simple calculator. However, I can't seem to find a way to overcome the aforementioned error when reaching the Math.Pow line. namespace BinaryCalc { class Binary { public static void Main() { int addition,subtraction; float division, multiplication, power, sqrt; int x; int y; x = 10; y = 7; //Console.WriteLine("Please enter a number for x"); //string line = Console.ReadLine(); //int x = int.Parse(line); //Console.WriteLine("Please enter a number for y"); //string line2 = Console.ReadLine(); //int y = int.Parse(line2); addition = (int)x + (int)y; subtraction = (int)x - (int)y; division = (float)x / (float)y; multiplication = (float)x * (float)y; power = Math.Pow(x,2); sqrt = Math.Sqrt(x); Console.WriteLine(" Addition results in {0}", addition); Console.WriteLine(" Subtraction results in {0}", subtraction); Console.WriteLine(" Division results in {0}", division); Console.WriteLine(" Multiplication results in {0}", multiplication); Console.WriteLine(" {0} squared results in {0}",x, power); Console.WriteLine(" Square root of {0} is: {0}", x, sqrt); } } }
0
0
0
0
1
0
I am sorry if this question sounds dumb. Why does inverse document frequency use log? How does log help in tf/idf?
0
0
0
0
1
0
I am looking for some suggestions on a problem that I am currently facing. I have a set of sensor say S1-S100 which is triggered when some event E1-E20 is performed. Assume, normally E1 triggers S1-S20, E2 triggers S15-S30, E3 triggers S20-s50 etc and E1-E20 are completely independent events. Occasionally an event E might trigger any other unrelated sensor. I am using ensemble of 20 svm to analyze each event separately. My features are sensor frequency F1-F100, number of times each sensor is triggered and few other related features. I am looking for a technique that can reduce the dimensionality of the sensor feature(F1-F100)/ or some techniques that encompasses all of the sensor and reduces the dimension too(i was looking for some information theory concept for last few days) . I dont think averaging, maximization is a good idea as I risk loosing information(it did not give me good result). Can somebody please suggest what am I missing here? A paper or some starting idea... Thanks in advance.
0
0
0
1
0
0
I'm looking for a CFG parser implemented with Java. The thing is I'm trying to parse a natural language. And I need all possible parse trees (ambiguity) not only one of them. I already researched many NLP parsers such as Stanford parser. But they mostly require statistical data (a treebank which I don't have) and it is rather difficult and poorly documented to adapt them in to a new language. I found some parser generators such as ANTRL or JFlex but I'm not sure that they can handle ambiguities. So which parser generator or java library is best for me? Thanks in advance
0
1
0
0
0
0
How would I get python to work with values of the order of magnitude of 1099511627776 bits large (yeah. 137 gb)? I some what need to implement this (or if you can suggest a better way to do it, will change methods). apparently, pgp's new length types have 3 sections instead of 2. now they are: length type, value-of-length-type, and the length. length type is 2 bits, which translates to 191 bytes, 8383 bytes, 4294967296 bytes, or partial length. the length is then encoded in bytes. how would i check if a value is less than 4294967296 bytes large if i cant even do 1 << (4294967296 << 8)? it is too big to fit in even a long.
0
0
0
0
1
0
What are the programming languages we can use in the development of an artificial intelligent system? which operating system should be used? can C or C++ programming languages be used?
0
1
0
0
0
0
I'm learning NLP. I currently playing with Word Sense Disambiguation. I'm planning to use the semcor corpus as training data but I have trouble understanding the xml structure. I tried googling but did not get any resource describing the content structure of semcor. <s snum="1"> <wf cmd="ignore" pos="DT">The</wf> <wf cmd="done" lemma="group" lexsn="1:03:00::" pn="group" pos="NNP" rdf="group" wnsn="1">Fulton_County_Grand_Jury</wf> <wf cmd="done" lemma="say" lexsn="2:32:00::" pos="VB" wnsn="1">said</wf> <wf cmd="done" lemma="friday" lexsn="1:28:00::" pos="NN" wnsn="1">Friday</wf> <wf cmd="ignore" pos="DT">an</wf> <wf cmd="done" lemma="investigation" lexsn="1:09:00::" pos="NN" wnsn="1">investigation</wf> <wf cmd="ignore" pos="IN">of</wf> <wf cmd="done" lemma="atlanta" lexsn="1:15:00::" pos="NN" wnsn="1">Atlanta</wf> <wf cmd="ignore" pos="POS">'s</wf> <wf cmd="done" lemma="recent" lexsn="5:00:00:past:00" pos="JJ" wnsn="2">recent</wf> <wf cmd="done" lemma="primary_election" lexsn="1:04:00::" pos="NN" wnsn="1">primary_election</wf> <wf cmd="done" lemma="produce" lexsn="2:39:01::" pos="VB" wnsn="4">produced</wf> <punc>``</punc> <wf cmd="ignore" pos="DT">no</wf> <wf cmd="done" lemma="evidence" lexsn="1:09:00::" pos="NN" wnsn="1">evidence</wf> <punc>''</punc> <wf cmd="ignore" pos="IN">that</wf> <wf cmd="ignore" pos="DT">any</wf> <wf cmd="done" lemma="irregularity" lexsn="1:04:00::" pos="NN" wnsn="1">irregularities</wf> <wf cmd="done" lemma="take_place" lexsn="2:30:00::" pos="VB" wnsn="1">took_place</wf> <punc>.</punc> </s> I'm assuming wnsn is 'word sense'. Is it correct? What does the attribute lexsn mean? How does it map to wordnet? What does the attribute pn refer to? (third line) How is the rdf attribute assigned? (again third line) In general, what are the possible attributes?
0
1
0
0
0
0
I have one application that register and verified user's fingerprint.Now I want to know which finger user try to register so, Is there anything common between all humans finger that we can identify the same ?
0
1
0
0
0
0
1. Find circle diameter from radius 2. Find circle diameter from perimeter 3. Find circle diameter from area 4. Find circle perimeter from diameter 5. Find circle perimeter from radius 6. Find circle radius from diameter 7. Find circle radius from perimeter 8. Find circle radius from area Currently our model class is implemented like this.. class Circle { double radius; Circle (double r) { } // Solves 6,7,8 double getDiameter() {} double getPerimeter() {} double getArea() {} // static functions to solve 1-5 // e.g. public static double getPermiter(double diameter) {..} } Is there a better way to model the above class, so that I can fetch the above information, since given a certain parameter (e.g. radius, diameter, area or perimeter) the user is expected to find other information.
0
0
0
0
1
0
I am performing some math in an SQL select statement but the number is always truncated to an int. How can I make it give me a double/float value? Example: select top 10 id, (select COUNT(*) from table1 / 100) from table2 If the value was 92.738 I just get 92
0
0
0
0
1
0
I'm trying to code a small math library in C#. I wanted to create a generic vector structure where the user could define the element type (int, long, float, double, etc.) and dimensions. My first attempt was something like this... public struct Vector<T> { public readonly int Dimensions; public readonly T[] Elements; // etc... } Unfortunately, Elements, being an array, is also a reference type. Thus, doing this, Vector<int> a = ...; Vector<int> b = a; a[0] = 1; b[0] = 2; would result in both a[0] and b[0] equaling 2. My second attempt was to define an interface IVector<T>, and then use Reflection.Emit to automatically generate the appropriate type at runtime. The resulting classes would look roughly like this: public struct Int32Vector3 : IVector<T> { public int Element0; public int Element1; public int Element2; public int Dimensions { get { return 3; } } // etc... } This seemed fine until I found out that interfaces seem to act like references to the underlying object. If I passed an IVector to a function, and changes to the elements in the function would be reflected in the original vector. What I think is my problem here is that I need to be able to create classes that have a user specified number of fields. I can't use arrays, and I can't use inheritance. Does anyone have a solution? EDIT: This library is going to be used in performance critical situations, so reference types are not an option.
0
0
0
0
1
0
Is it possible to extract noun+noun or (adj|noun)+noun using the R package openNLP? That is, I would like to use linguistic filtering to extract candidate noun phrases. Could you direct me how to do? Many thanks. Thanks for the responses. here is the code: library("openNLP") acq <- "Gulf Applied Technologies Inc said it sold its subsidiaries engaged in pipeline and terminal operations for 12.2 mln dlrs. The company said the sale is subject to certain post closing adjustments, which it did not explain. Reuter." acqTag <- tagPOS(acq) acqTagSplit = strsplit(acqTag," ") acqTagSplit qq = 0 tag = 0 for (i in 1:length(acqTagSplit[[1]])){ qq[i] <-strsplit(acqTagSplit[[1]][i],'/') tag[i] = qq[i][[1]][2] } index = 0 k = 0 for (i in 1:(length(acqTagSplit[[1]])-1)) { if ((tag[i] == "NN" && tag[i+1] == "NN") | (tag[i] == "NNS" && tag[i+1] == "NNS") | (tag[i] == "NNS" && tag[i+1] == "NN") | (tag[i] == "NN" && tag[i+1] == "NNS") | (tag[i] == "JJ" && tag[i+1] == "NN") | (tag[i] == "JJ" && tag[i+1] == "NNS")) { k = k +1 index[k] = i } } index Reader can refer index on acqTagSplit to do noun+noun or (adj|noun)+noun extraction. (The code is not optimal, but it works. If you have any idea, please let me know.) I have an additional problem: Justeson and Katz (1995) proposed another linguistic filtering to extract candidate noun phrases: ((Adj|Noun)+|((Adj|Noun)*(Noun-Prep)?)(Adj|Noun)*)Noun I cannot understand its meaning well. Could you do me a favor and explain it? Or show how to code the filtering rule in the R language? Many thanks.
0
1
0
0
0
0
px and py are the x and y coordinates of a point on a circle's circumference. Given: the center of the circle as: cx, cy the radius of the circle as: r px How to calculate the value of py? Thanks!
0
0
0
0
1
0
I have a dataset containing n values between 0 and m. Now i want to map this values in the range between min and max. But how do I do that? If i have in every object this method: public double getValue(int min, int max) { // return value between min and max; } This want work I think?
0
0
0
0
1
0
I am working on code for Scrolling Game Development Kit. An old release (2.0) of this program was based on DirectX and was using Direct3D Sprite objects to draw all the graphics. It used the Transform property of the sprite object to specify how the texture rectangle would be transformed as it was being output to the display. The current release (2.1) was a conversion to OpenGL and is using GL TexCoord2 and GL Vertex2 calls to send coordinates of the source and output rectangles for drawing sprites. Now someone says that their video card worked great with DirectX, but their OpenGL drivers do not support GL_ARB necessary to use NPOTS textures (pretty basic). So I'm trying to go back to DirectX without reverting everything back to 2.0. Unfortunately it seems it's much easier to get 4 points given a matrix than it is to get a matrix given 4 points. I have done away with all the matrix info in version 2.1 so I only have the 4 corner points left when calling the function that draws images on the display. Is there any way to use the 4 corner information to transform a Direct3D Sprite? Alternatively does anybody know why DirectX would be able to do something than OpenGL can't -- are some video cards' drivers just that bad where DirectX supports NPOTS textures but OpenGL doesn't?
0
0
0
0
1
0
I've recently ran into the following problem. Given a list of vectors (here I mean tuple) all with integer entries, is there a package (language isn't too much an issue, the faster the better, so I guess C) to very quickly determine when another integer vector is in the span of the original list? I need to do this arithmetic over the integers (no division). I'm sure there is one, but wanted to circumvent the lengthy literature review.
0
0
0
0
1
0
I have a 2.5d viewport wherein I am trying to express a visualization of the depth of a box with 45 degree 2D lines inwards as if it had no front and you were staring inside from a central point, like this: ------------- | \_______/ | | | | | | |_______| | | / \ | ------------- I want to draw the metaphor with real 3D geometry, in that the distance of the inner rect from the outer rect is correct, given a camera distance (say fixed at 2 feet for an average eye distance from the user's monitor) How can I derive the "common inner side width" from: the centered camera distance, the width and height of the box, and the depth I'm trying to represent? Thanks!
0
0
0
0
1
0
I have 2 variables: $vatRate and $priceExVat. I want to create another variable named $endPrice which adds the VAT on. I have no clue on how to do this, and am a begginner at PHP so I would like to have a code example ;) $priceExVat == $_POST['priceExVat']; $vatRate = $_POST['vatRate']; rtrim($vatRate ,'%'); $endPrice = ($vatRate * $priceExVat) + $priceExVat; echo $endPrice; EDIT: Above is the non-working code which returns a 0
0
0
0
0
1
0
Imagina a sine wave oscillating about a zero line. My task is to calculate the slope at several random points along the wave using a fairly coarse x axis scale. (yes this has a real application) When the wave is in +ve terrirtory (above the zero line) slope can be calculated from: Slope = (y(n) / y(n-1)) - 1 This yeilds +ve slope vlaues heading up and -ve heading down. The problem is that this must be switched when we are in -ve territory and then two more expressions are required when one of the vlaues is zero for a total of four expressions that must be chosen programatically with a conditional statements. I would like to find ONE expression that covers all four condtions as this is at the center of a heavily travelled algorithm and clks count! I am sure this would be a trivial solution for a math genius, but to these tired eyes, it eludes me... Added: The "sine wave" is actually an MACD indicator that is derived from (random) price action of financial markets. an example would be here: http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:moving_average_conve The slope (of the thick black line in the lower graph for example) is what I need to calculate here defined simply as up or down (where heading up is +ve) The problem is that both +ve and -ve slope can occur above and below zero. A slope calcualtion may also occur using increments that cross the zero line and at the zero line. It would be nice to find a solution that not involve a ton of IF statements... like for example, shifing all the y values by a fixed amount so they become +ve and then calculating slope in the +ve region. I would need to pick a number that historically, y has never been below, like a couple of orders of magnitude for example (99) and then I could perform the offest and one slope calculation?
0
0
0
0
1
0
Possible Duplicate: C# linear algebra library Can you recommend a good .net library for linear algebra? I've seen libraries ranging from free to $999. I'm not opposed to paying, but would like to keep costs down. If you've used such a library, could you comment on your experience developing against the lib?
0
0
0
0
1
0
Twitter recently announced that you can approximate the rank of any given twitter user with high accuracy by inputting their follower count in the following formula: exp($a + $b * log(follower_count)) where $a=21 and $b=-1.1 This is obviously a lot more efficient than sorting the entire list of users by follower count for a given user. If you have a similar data set from a different social site, how could you derive the values for $a and $b to fit that data set? Basically some list of frequencies the distribution of which is assumed to be power law.
0
0
0
0
1
0
Let's say I have a simple line chart with 5 values (a = 155, b = 200, c = 250, d = 300, e 0 345) I need a way to calculate which values go on the Y-axis, in such a way that the values look nice. I also want to see the minor steps. If I use a simple formula I would do this: MaxValue - Minvalue = difference 345 - 155 = 190 For 5 steps: 190 / 4 = 47.50 per step Thet would lead to these values for the Y-axis: Y0 = 155 Y1 = 203 Y2 = 250 Y3 = 298 Y4 = 345 What I actually would like is the values to be: Y0 = 150 Y1 = 200 Y2 = 250 Y3 = 300 Y4 = 350 But how do I calculate this? Before calculation I don't know the magnitude of the values, it could be also like thousands, or tens. I hope I did explain it ok. English is not my main language, so please ask if things are not clear.
0
0
0
0
1
0
Question: When a CPU can perform a multiplication in 12 nanoseconds (ns), an addition in 1 ns, and a subtraction in 1.5 ns, which of the following is the minimum CPU time, in nanoseconds, for the calculation of “a×a – b×b ” ? Answer: 14.5
0
0
0
0
1
0
I've been reading some online tutorials about Neurons, Percepton and Multi Layer Perceptron concepts. Now, I would like to implement the concept in my own examples. What I would like to do is to implement the following simple algorithm into my network: Assuming we have 4 floating numbers minus1, plus1, minus2, plus2 if (minus2>plus2) and (minus1<plus1) then return 1 else if (minus2<plus2) and (minus1>plus1) then return -1 else return 0 But here are my concerns: How do I feed my network with such numbers: 63.8990, -165.177, 1.33001 or 0.98401? How should I choose the number of inputs as I have 4 numbers but I don't know if I should use just 4 inputs or convert everything in bits first and choose the number of inputs according to the numbers of related bits? Considering the 3 types of output (1,-1,0) should I need 3 neurons in my output layer each one representing a specific type of answer or maybe I should train the network to learn seperately each kind of answer (1 for the first network, -1 for the second and 0 for the last one) ? Thank you all in advance for even reading and your help is highly appreciated Stephane
0
1
0
0
0
0
I'm writing an isometric tile game. Each tile is twice as wide as it is tall (w:h = 2:1). All tiles in a map are the same size and their width and heights are known (TileWidth and TileHeight). There can be any number of columns (>0) and rows (>0). I'm struggling to come up with a formula to calculate the width and height of the fully drawn map. This needs to be the distance from the very top to the very bottom and the extreme left to the extreme right. As the number of columns and rows can vary (and thus the map is not always a perfect diamond) it's proving very hard!
0
0
0
0
1
0
I've got a space that has nodes that are all interconnected, based on a "similarity score". I would like to determine how "connected" a node is with the others. My purpose is to find nodes that are poorly connected to make sure that the backlink from the other node is prioritized. Perhaps an example would help. I've got a web page that links to my other pages based on a similarity score. Suppose I have the pages: A, B, C, ... A has a backlink from every other page, so it's very well connected. It also has links to all my other pages (each line in the graph is essentially bidirectional). B only has 1 backlink, from A. C has a link from A and D. I would like to make sure that the A->B link is prioritized over the A->C link (even if the similarity score between C and A is higher than B and A). In short, I would like to evaluate which nodes are least and best connected, so that I can mangle the results to my means. I believe this is Graph Connectedness, but I'm at a loss to develop a (simple) algorithm that will help me here. Simply counting the backlinks to a node may be a starting point -- but then how do I take the next step, which is to properly weight the links on the original node (A, in the example above)?
0
0
0
0
1
0
If I have several sets of numbers (just a 2D array where each row is a set): [ 1, 3, -1, -1] [ 2, 4, -1, -1] [ 7, 8, 9, 10] What would be an algorithm to create a list of sums (ignoring -1's)? the result for the above would be: 1+2+7, 1+2+8, 1+2+9, 1+2+10, 1+4+7, 1+4+8, 1+4+9, 1+4+10, 3+2+7, 3+2+8, 3+2+9, 3+2+10, 3+4+7, 3+4+8, 3+4+9, 3+4+10
0
0
0
0
1
0
I'm a third year irregular CS student and ,i just realized that i have to start coding. I passed my coding classes with lower bound grades so that i haven't a good background in coding&programming. I'm trying to write a code that generates prime numbers between given upper and lower bounds. Not knowing C well, enforce me to write a rough code then go over it to solve. I can easily set up the logic for intended function but i probably create a wrong algorithm through several different ways. Here I share my last code, i intend to calculate that when a number gives remainder Zero , it should be it self and 1 , so that count==2; What is wrong with my implementation and with my solution generating style? I hope you will warm me up to programming world, i couldn't find enough motivation and courage to get deep into programming. Stdio and Math.h is İncluded int primegen(int down,int up) { int divisor,candidate,count=0,k; for(candidate=down;candidate<=up;candidate++) { for(divisor=1;divisor<=candidate;divisor++) { k=(candidate%divisor); } if (k==0) count++; if(count==2) { printf("%d ", candidate); count=0; } else { continue; } } } int main() { primegen(3,15); return 0; }
0
0
0
0
1
0
Suppose we got several centers {C1(d1, d2...dn), C2...} with training samples according to spectral clustering algorithm. If a new test sample vector (x1, ... xn) is given, what should I do to get it into a class? Note that, the similarity matrix we used in spectral clustering process is not only based on Euclidean distance between training vectors but geodesic distance. So the distance can not be calculated with just two vectors, and the class center is not so easy to get as what we can in K-means. One solution I have got is k-nearest neighbour algorithm. Are there any other solutions?
0
0
0
1
0
0
If i have n elements, say a, b, c Then i can use 6 comparison with (n-1) comparators to sort the elements: if (a > b && b > c) { a, b, c } else if (a < b && b < c) { c, b, a } else if (b > a && a > c) { b, a, c } else if (a > c && c > b) { a, c, b } else if (b > c && c > a) { b, c, a } else if (c > a && a > b) { c, a, b } Now I have two questions: Do this 6 comparisations cover all possibile combinations of the 3 elements? If yes, is it true that to compare n elements, n! comparisations with (n-1) comparators are needed?
0
0
0
0
1
0
I have custom control - chart with size, for example, 300x300 pixels and more than one million points (maybe less) in it. And its clear that now he works very slowly. I am searching for algoritm which will show only few points with minimal visual difference. I have a link to the component which have functionallity exactly what i need (2 million points demo): I will be grateful for any matherials, links or thoughts how to realize such functionallity.
0
0
0
0
1
0
I'm doing some heavy work on large integer numbers in UInt64 values, and was wondering if Delphi has an integer square root function. Fow now I'm using Trunc(Sqrt(x*1.0)) but I guess there must be a more performant way, perhaps with a snippet of inline assembler? (Sqrt(x)with x:UInt64 throws an invalid type compiler error in D7, hence the *1.0 bit.)
0
0
0
0
1
0
I'm trying to get my head wrapped around tangent space and I'm starting to come up with questions that I can't ask my colleagues because they're starting to have no idea what I'm talking about. I'm trying to do normal mapping on opengl. My current plan is to calculate the tangent-bitangent-normal matrix in a geometry shader. When I have an orthogonal matrix (such as the TBN matrix) and I let opengl interpolate it between vertices, are the three resulting vectors (T, B and N) then still unit length? are they still at a 90 deg angle to each other? When I multiply my (unit length) normal map sample with my orthogonal matrix, is the result guaranteed to be unit length too? I think it is but can't reason through it. I was thinking about using detail normal maps such that objects up close don't look as bad as they do now. That would mean that there's then two normal maps. How do I combine the two samples? To reply to my own question, a colleague came over to work on #2 and he came up with an elegant proof. It's a bit much to type out here but suffice to say that it's true.
0
0
0
0
1
0
I have a circle divided into fourths. I need an algorithm that can rotate the circle from one position to another in the most efficient way. The "trays" are named 1 to 4. I now use the algoritm: int degrees = (currentPos - newPos) * 90; using the algorithm i get how many degrees i need to rotate the circle to get to the new position. However if i am in position 4 and need to go to 1, the result will be 4 - 1 * 90 = 270. In this case the most efficient would be to rotate -90 instead of 270. (the same goes for moving from 1 to 4). Anyone got a good idea of how to do this? I can of course use an if statement: if(degrees >= -180 && degrees <= 180) sortingTrayMotor.rotate(degrees); else if(degrees == -270) sortingTrayMotor.rotate(90); else sortingTrayMotor.rotate(-90); I guess there is a better way to do it though with some mod operation.
0
0
0
0
1
0
This question burns my brain. I have an object on a plane, but for the sake of simplicity let's work just on a single dimension, thus the object has a starting position xs. I know the ending position xe. The object has to move from starting to ending position with an accelerated (acceleration=a) movement. I know the velocity the object has to have at the ending position (=ve). In my special case the ending speed is zero, but of course I need a general formula. The only unknown is the starting velocity vs. The objects starts with vs in xs and ends with ve in xe, moving along a space x with an acceleration a in a time t. Since I'm working with flash, space is expressed in pixels, time is expressed in frames (but you can reason in terms of seconds, it's easy to convert knowing the frames-per-second). In the animation loop (think onEnterFrame) I compute the new velocity and the new position with (a=0.4 for example): vx *= a (same for vy) x += vx (same for y) I want the entire animation to last, say, 2 seconds, which at 30 fps is 60 frames. Now you know that in 60 frames my object has to move from xs to xe with a constant deceleration so that the ending speed is 0. How do I compute the starting speed vs? Maybe there's a simpler way to do this in Flash, but I am now interested in the math/physics behind this. edit as per DSM answer. I've tried to apply his suggestions: var vx:Number; var a = -0.5; var xs:Number = 0; var xe:Number = Stage.width; var mc:MovieClip; var keyListener = {}; var startTime:Number; init(); function init() { mc = attachMovie("pallino", "p1", 0); mc._y = Stage.height/2; Key.addListener(keyListener); } Acceleration is -0.5, starting x is 0, ending x is the stage width. I attach a movieclip to the middle of the stage and then wait for a keypress. Then: keyListener.onKeyDown = function() { var k = Key.getCode(); mc._x = xs; vx = 2 * (xe - xs) / 60; trace("vx:"+vx); startTime = new Date().getTime(); onEnterFrame = startAnimation; } In the keypress event I set the starting velocity; here I use 60 for the time because my stage is set at 30 fps and I want the animation to happen in 2 seconds. Finally the animation is: function startAnimation() { trace("running, vx:" + vx); mc._x += vx; vx += a; if ( mc._x >= xe ) { trace("stopping because clip is on target position"); stopAnimation(); return; } if ( vx <= 0 ) { trace("stopping because speed is too slow"); stopAnimation(); return; } } function stopAnimation() { this.onEnterFrame = null; var secsElapsed:Number = ( new Date().getTime() - startTime) / 1000; trace(secsElapsed); } The animation stops because the speed is too slow (less than zero) before the clip reaches the destination x. Why??
0
0
0
0
1
0
My tile engine is coming along. It can draw square, hexagonal and isometric staggered viewpoints. Where I'm struggling is with the isometric rotated (or diamond) viewpoint. Below is a picture of a 10x10 diamond map and the (simplified) code used to draw it. The tiles are 128x64. http://garrypettet.com/images/forum_images/5%20col%20x%205%20rows.png for row = 0 to rowLimit for column = 0 to columnLimit x = column * (TileWidth/2) + (row * (TileWidth/2)) + Origin.X y = (column * (TileHeight/2)) - (row * (TileHeight/2)) + Origin.Y // Draw the tile's image buffer.Graphics.DrawPicture(Tiles(column, row).Image, x, y) next column next row // Draw the buffer to the canvas g.DrawPicture(buffer, 0, 0) I know that this will draw the contents of the whole of Tiles() and not just those visible on screen but I'm trying to get the basics first. What I can't figure out is an easy way to convert x,y coordinates on the map to tile column,row coordinates. I tried to reverse: x = column * (TileWidth/2) + (row * (TileWidth/2)) + Origin.X y = (column * (TileHeight/2)) - (row * (TileHeight/2)) + Origin.Y To work out column and row given x and y and came up with this: column = ((x/2) - (Origin.X/2) + y + Origin.Y) / TileHeight row = ((x/2) - (Origin.X/2) - y - Origin.Y) / TileHeight But that doesn't seem to work. Can anyone think of a better way to do this? Is there a better way to transform a grid of rectangles into a diamond and back again (given that I know very little about matrices....). Thanks,
0
0
0
0
1
0
I need an algorithm that converts an arbitrarily sized unsigned integer (which is stored in binary format) to a decimal one. i.e. to make it human-readable ;) I currently use the maybe (or obviously) somewhat naive way of continuously calculating the modulus and remainder through division through ten. Unfortunately the speed is somewhat... lame. e.g. I calculate 2000^4000 (with my bignum library) which takes roughly 1.5 seconds (no flaming please xD). The print including the necessary base conversion however takes about 15 minutes which is quite annoying. I have tested bc which does both in a lot less than one second. How does it do that? (Not the multiplication stuff with ffts and whatever only the base conversion)
0
0
0
0
1
0
I'm embarrassed to ask this question, but after 45 minutes of not finding a solution I will resort to public humiliation. I have a number that is being divided by another number and I'm storing that number in a double variable. The numbers are randomly generated, but debugging the app shows that both numbers are in fact being generated. Lets just say the numbers are 476 & 733. I then take the numbers and divide them to get the percentage 476/733 = .64 I then print out the variable and it's always set to 0. I've tried using DecimalFormat and NumberFormat. No matter what I try though it always says the variable is 0. I know there is something simple that I'm missing, I just can't find it =/.
0
0
0
0
1
0
This may be ridiculously obvious, but math wasn't my strong suit in school. I've been banging my head against the wall long enough that I finally figured I'd ask. I'm trying to animate a sprite moving along a 2D parabolic path, from point A to point B. Both points are at the same y-coordinate. The desired height of the parabola from the starting/ending y-coordinate is also given (or, if you prefer, a desired velocity). Currently in my code I have a timer firing at a high frequency. I would like to calculate the new location of the ball based on the amount of time that has passed. So a parametric parabola equation should work nicely. I found this answer from GameDev adequate, until my requirements grew (although I'm not sure its really a parabolic path... I can't follow the derivation of the final equations there provided). Now I would like to squish/stretch the sprite at different points along the parabolic path. But to get the effect to work right, I'll need to rotate the sprite so that it's primary axis is tangential to the path. So I need to be able to derive the angle of the tangent at any given location/time. I can find all sorts of equations for each of these requirements (parametric parabola, tangent at a point, etc.), but I just can't figure out how to unify them all. Could someone with more math skills help a fellow coder out and provide a set of equations that will work? Thanks ever so much in advance.
0
0
0
0
1
0
Is it possible to extract ((Adj|Noun)+|((Adj|Noun)(Noun-Prep)?)(Adj|Noun))Noun proposed by Justeson and Katz (1995) using the R package openNLP? That is, I would like to use this linguistic filtering to extract candidate noun phrases. I cannot understand its meaning well. Could you do me a favor to explain it? Or show how to code the filtering rule in the R language? Many thanks. Maybe we can start the sample code from: library("openNLP") acq <- "This paper describes a novel optical thread plug gauge (OTPG) for internal thread inspection using machine vision. The OTPG is composed of a rigid industrial endoscope, a charge-coupled device camera, and a two degree-of-freedom motion control unit. A sequence of partial wall images of an internal thread are retrieved and reconstructed into a 2D unwrapped image. Then, a digital image processing and classification procedure is used to normalize, segment, and determine the quality of the internal thread." acqTag <- tagPOS(acq) acqTagSplit = strsplit(acqTag," ") I was told to open a new question for this. The original question is here.
0
1
0
0
0
0
For example, if you feed {x|xεZ,0<x} to it, it returns { 1,2,3,4,5,6,7,8,9,10,11,...}
0
0
0
0
1
0
how to use minipar parser output to extract features like subject , object ,verb, tense etc to be use for english text to ASL conversion project
0
1
0
0
0
0
Greetings, I have an interview coming up in early February with a company developing GIS and fleet management products and was told that I will be given a number of Maths questions in the interview. I have done a bit of math at university though I now naturally want to go over/read up on what could be most relevant. As Maths is quite broad, I was hoping that there might be some SO community members in the field of GIS that could recommend areas to read up on. I haven't been told what to expect, so my plan so far is to have a look at linear algebra, geometry and discrete math (never taken a discrete math course). I don't have too much time so I'd appreciate some suggestions on areas of Maths what you'd consider most fundamental for GIS. Thanks!
0
0
0
0
1
0
The question may seem vague, but let me explain it. Suppose we have a function f(x,y,z ....) and we need to find its value at the point (x1,y1,z1 .....). The most trivial approach is to just replace (x,y,z ...) with (x1,y1,z1 .....). Now suppose that the function is taking a lot of time in evaluation and I want to parallelize the algorithm to evaluate it. Obviously it will depend on the nature of function, too. So my question is: what are the constraints that I have to look for while "thinking" to parallelize f(x,y,z...)? If possible, please share links to study.
0
0
0
0
1
0
Jon Skeet reports today (source) that : Math.Max(1f, float.NaN) == NaN new[] { 1f, float.NaN }.Max() == 1f Why? Edit: same issue with double also!
0
0
0
0
1
0
The problem is: For a prime number p the set of co-primes less than or equal to it is given by {1,2,3,4,...p-1} . We define f(x,p) 0 < x < p = 1 if and only if all the numbers from 1 to p-1 can be written as a power of x in modulo-p arithmetic . Let n be the largest 12-digit prime number . Find the product of all integers j less than n such that f(j,n)=1, in modulo-n arithmetic Can anyone give me a better explanation?
0
0
0
0
1
0
I am trying to understand what is the relevance score that opencalais returns associated with each entity? What does it signify and how is it to be interpreted? I would be thankful for insights into this.
0
1
0
0
0
0
I want to implement greatest integer function. [The "greatest integer function" is a quite standard name for what is also known as the floor function.] int x = 5/3; My question is with greater numbers could there be a loss of precision as 5/3 would produce a double? EDIT: Greatest integer function is integer less than or equal to X. Example: 4.5 = 4 4 = 4 3.2 = 3 3 = 3 What I want to know is 5/3 going to produce a double? Because if so I will have loss of precision when converting to int. Hope this makes sense.
0
0
0
0
1
0
I have page that automatically calculates a Total by entering digits into the fields or pressing the Plus or Minus buttons. I need to add a second input after the Total that automatically divides the total by 25. Here is the working code with no JavaScript value for the division part of the code: <html> <head> <script language="text/javascript"> function Calc(className){ var elements = document.getElementsByClassName(className); var total = 0; for(var i = 0; i < elements.length; ++i){ total += parseFloat(elements[i].value); } document.form0.total.value = total; } function addone(field) { field.value = Number(field.value) + 1; Calc('add'); } function subtractone(field) { field.value = Number(field.value) - 1; Calc('add'); } </script> </head> <body> <form name="form0" id="form0"> 1: <input type="text" name="box1" id="box1" class="add" value="0" onKeyUp="Calc('add')" onChange="updatesum()" onClick="this.focus();this.select();" /> <input type="button" value=" + " onclick="addone(box1);"> <input type="button" value=" - " onclick="subtractone(box1);"> <br /> 2: <input type="text" name="box2" id="box2" class="add" value="0" onKeyUp="Calc('add')" onClick="this.focus();this.select();" /> <input type="button" value=" + " onclick="addone(box2);"> <input type="button" value=" - " onclick="subtractone(box2);"> <br /> 3: <input type="text" name="box3" id="box3" class="add" value="0" onKeyUp="Calc('add')" onClick="this.focus();this.select();" /> <input type="button" value=" + " onclick="addone(box3);"> <input type="button" value=" - " onclick="subtractone(box3);"> <br /> <br /> Total: <input readonly style="border:0px; font-size:14; color:red;" id="total" name="total"> <br /> Totaly Divided by 25: <input readonly style="border:0px; font-size:14; color:red;" id="divided" name="divided"> </form> </body></html> I have the right details but the formulas I am trying completely break other aspects of the code. I cant figure out how to make the auto adding and auto dividing work at the same time
0
0
0
0
1
0
I have this JavaScript equation which I'm now trying to transform to PHP. JavaScript: LVL=new Array(); LVL[1]=128; LVL[0]=128; m=.05; for (i=1;i<101;i++) { if (i>1) { LVL[i]=Math.floor(LVL[i-1]+(LVL[i-1]*m)); m=m+.0015; } } then it's a bunch of document.writes of a table and a for loop. Here's what I have so far (which is NOT working): <?php $n = 1; // level $m = .05; // exp modifier $exp = floor($n*1+($n-1)*$m); echo "Level " . $n . ", exp needed: " . $exp; // 128 exp ?> The PHP output is: Level 1, exp needed: 1 and that's WRONG. It SHOULD say: Level 1, exp needed: 128 What am I doing wrong?
0
0
0
0
1
0
I would like to build a Connect 4 engine which works using an artificial neural network - just because I'm fascinated by ANNs. I'be created the following draft of the ANN structure. Would it work? And are these connections right (even the cross ones)? Could you help me to draft up an UML class diagram for this ANN? I want to give the board representation to the ANN as its input. And the output should be the move to chose. The learning should later be done using reinforcement learning and the sigmoid function should be applied. The engine will play against human players. And depending on the result of the game, the weights should be adjusted then. What I'm looking for ... ... is mainly coding issues. The more it goes away from abstract thinking to coding - the better it is.
0
1
0
0
0
0
I have four sets of algorithms that I want to set up as modules but I need all algorithms executed at the same time within each module, I'm a complete noob and have no programming experience. I do however, know how to prove my models are decidable and have already done so (I know Applied Logic). The models are sensory parsers. I know how to create the state-spaces for the modules but I don't know how to program driver access into ProLog for my web cam (I have a Toshiba Satellite Laptop with a built in web cam). I also don't know how to link the input from the web cam to the variables in the algorithms I've written. The variables I use, when combined and identified with functions, are set to identify unknown input using a probabilistic, database search for best match after a breadth first search. The parsers aren't holistic, which is why I want to run them either in parallel or as needed. How should I go about this?
0
1
0
0
0
0
I use Vim to edit my Latex document. Depending on the conference/journal I am submitting to, the university I am studying at, etc., I might like to convert from British English to American English or vice versa. Does anybody know if there is a plug-in to do that?
0
1
0
0
0
0
I am looking for a solution: A= {0,1,2,3,4}; F(x) = 3x - 1 (mod5) Could you help me to find the inverse. I am struggling with this as it seems to be not to be onto or 1to1. Thank you for your help.
0
0
0
0
1
0
How can we computer (N choose K)% M in C or C++ without invoking overflow ? For the particular case when N (4<=N<=1000) and K (1<=K<=N) and M = 1000003.
0
0
0
0
1
0
How can I get a random point within a ring? Like, the space between two concentric circles. I make the circles in code myself so I know the radius, etc. This is for a game I am working on where I am spacing the enemies out in waves, or different rings spaced from the center of the field. I was thinking the only way is some kind of loop that checks points or something. As3
0
0
0
0
1
0
The sum of f(i) for all integers i = k, k + 1, .., continuing only as long as the condition p(i) holds. I'm going for: for (i = 0; i <= V_COUNT; i++) { sum += sine_coeff[i] * pow(E, e_factor[i]) * sin( (solar_coeff[i] * solar_anomaly) + (lunar_coeff[i] * lunar_anomaly) + (moon_coeff[i] * moon_argument) ); } based on the following Common LISP code: (sigma ((v sine-coeff) (w E-factor) (x solar-coeff) (y lunar-coeff) (z moon-coeff)) (* v (expt cap-E w) (sin-degrees (+ (* x solar-anomaly) (* y lunar-anomaly) (* z moon-argument))))))) where sigma is: (defmacro sigma (list body) ;; TYPE (list-of-pairs (list-of-reals->real)) ;; TYPE -> real ;; $list$ is of the form ((i1 l1)..(in ln)). ;; Sum of $body$ for indices i1..in ;; running simultaneously thru lists l1..ln. `(apply '+ (mapcar (function (lambda ,(mapcar 'car list) ,body)) ,@(mapcar 'cadr list)))) (for full source code, see Calendrical calculations source code Edit Thanks for all your answers. Investigating the code examples, I have come to the conclusion that, in programming terms, the author indeed ment that one has to loop over a certain set of values. From that, it was easy to conclude that p had to return False when it has run out of values, i.e. control has reached the end of the list.
0
0
0
0
1
0
I'm trying to implement a version of the Fuzzy C-Means algorithm in Java and I'm trying to do some optimization by computing just once everything that can be computed just once. This is an iterative algorithm and regarding the updating of a matrix, the pixels x clusters membership matrix U (the sum of the values in a row must be 1.0), this is the update rule I want to optimize: where the x are the element of a matrix X (pixels x features) and v belongs to the matrix V (clusters x features). And m is a parameter that ranges from 1.1 to infinity and c is the number of clusters. The distance used is the euclidean norm. If I had to implement this formula in a banal way I'd do: for(int i = 0; i < X.length; i++) { int count = 0; for(int j = 0; j < V.length; j++) { double num = D[i][j]; double sumTerms = 0; for(int k = 0; k < V.length; k++) { double thisDistance = D[i][k]; sumTerms += Math.pow(num / thisDistance, (1.0 / (m - 1.0))); } U[i][j] = (float) (1f / sumTerms); } } In this way some optimization is already done, I precomputed all the possible squared distances between X and V and stored them in a matrix D but that is not enough, since I'm cycling througn the elements of V two times resulting in two nested loops. Looking at the formula the numerator of the fraction is independent of the sum so I can compute numerator and denominator independently and the denominator can be computed just once for each pixel. So I came to a solution like this: int nClusters = V.length; double exp = (1.0 / (m - 1.0)); for(int i = 0; i < X.length; i++) { int count = 0; for(int j = 0; j < nClusters; j++) { double distance = D[i][j]; double denominator = D[i][nClusters]; double numerator = Math.pow(distance, exp); U[i][j] = (float) (1f / (numerator * denominator)); } } Where I precomputed the denominator into an additional column of the matrix D while I was computing the distances: for (int i = 0; i < X.length; i++) { for (int j = 0; j < V.length; j++) { double sum = 0; for (int k = 0; k < nDims; k++) { final double d = X[i][k] - V[j][k]; sum += d * d; } D[i][j] = sum; D[i][B.length] += Math.pow(1 / D[i][j], exp); } } By doing so I encounter numerical differences between the 'banal' computation and the second one that leads to different numerical value in U (not in the first iterates but soon enough). I guess that the problem is that exponentiate very small numbers to high values (the elements of U can range from 0.0 to 1.0 and exp , for m = 1.1, is 10) leads to very small values, whereas by dividing the numerator and the denominator and THEN exponentiating the result seems to be better numerically. The problem is it involves much more operations. UPDATE Some values I get at ITERATION 0: This is the first row of the matrix D not optimized: 384.6632 44482.727 17379.088 1245.4205 This is the first row of the matrix D the optimized way (note that the last value is the precomputed denominator): 384.6657 44482.7215 17379.0847 1245.4225 1.4098E-26 This is the first row of the U not optimized: 0.99999213 2.3382613E-21 2.8218658E-17 7.900302E-6 This is the first row of the U optimized: 0.9999921 2.338395E-21 2.822035E-17 7.900674E-6 ITERATION 1: This is the first row of the matrix D not optimized: 414.3861 44469.39 17300.092 1197.7633 This is the first row of the matrix D the optimized way (note that the last value is the precomputed denominator): 414.3880 44469.38 17300.090 1197.7657 2.0796E-26 This is the first row of the U not optimized: 0.99997544 4.9366603E-21 6.216704E-17 2.4565863E-5 This is the first row of the U optimized: 0.3220644 1.5900239E-21 2.0023086E-17 7.912171E-6 The last set of values shows that they are very different due to a propagated error (I still hope I'm doing some mistake) and even the constraint that the sum of those values must be 1.0 is violated. Am I doing something wrong? Is there a possible solution to get both the code optimized and numerically stable? Any suggestion or criticism will be appreciated.
0
0
0
0
1
0
I am new to Stanford POS tagger. I need to call the Tagger from my java program and direct the output to a text file. I have extracted the source files from Stanford-postagger and tried calling the maxentTagger, but all I find is errors and warnings. Can somebody tell me from the scratch about how to call maxentTagger in my program, setting the classpath if required and other such steps. Please help me out.
0
1
0
0
0
0
In particular, I would like to be able to extract people, places, films, music, etc. entities and have the entities available in widely used linked data IDs such as DBpedia, Freebase, or OpenCyc.
0
1
0
0
0
0
... or is gender information enough? More specifically, I'm interested in knowing if I can reduce the number of models loaded by the Stanford Core NLP to extract coreferences. I am not interested in actual named entity recognition. Thank you
0
1
0
0
0
0
I need to parse algebraic expressions for an application I'm working on and am hoping to garnish a bit of collective wisdom before taking a crack at it and, possibly, heading down the wrong road. What I need to do is pretty straight forward: given a textual algebraic expression (3*x - 4(y - sin(pi))) create a object representation of the equation. The custom objects already exist, so I need a parser that creates a tree I can walk to instantiate the objects I need. The basic requirements would be: Ability to express the algebra as a grammar so I have control and can customize/extend it as necessary. The initial syntax will include integers, real numbers, constants, variables, arithmetic operators (+, - , *, /), powers (^), equations (=), parenthesis, precedence, and simple functions (sin(pi)). I'm hoping to extend my app fairly quickly to support functions proper (f(x) = 3x +2). Must compile in C as it needs to be integrated into my code. I DON'T need to evaluate the expression mathematically, so software that solves for a variable or performs the arithmetic is noise. I've done my Google homework and it looks like the best approach is to use a BNF grammar and software to generate a compiler in C. So my questions: Does a BNF grammar with corresponding parser generator for algebraic expressions (or better yet, LaTex) already exist? Someone has to have done this already. I REALLY want to avoid rolling my own, mainly because I don't want to test it. I'd be willing to pay a reasonable amount for a library (under $50) If not, which parser generator for C do you think is the easiest to learn/use here? Lex? YACC? Flex, Bison, Python/SymPy, Others? I'm not familiar with any of these.
0
0
0
0
1
0
Obvious (but expensive) solution: I would like to store rating of a track (1-10) in a table like this: TrackID Vote And then a simple SELECT AVERAGE(Vote) FROM `table` where `TrackID` = some_val to calculate the average. However, I am worried about scalability on this, especially as it needs to be recalculated each time. Proposed, but possibly stupid, solution: TrackID Rating NumberOfVotes Every time someone votes, the Rating is updated with new_rating = ((old_rating * NumberOfVotes) + vote) / (NumberOfVotes + 1) and stored as the TrackID's new Rating value. Now whenever the Rating is wanted, it's a simple lookup, not a calculation. Clearly, this does not calculate the mean. I've tried a few small data sets, and it approximates the mean. I believe it might converge as the data set increases? But I'm worried that it might diverge! What do you guys think? Thanks!
0
0
0
0
1
0
I have a start point in 3D coordinates, e.g. (0,0,0). I have the direction I am pointing, represented by three angles - one for each angle of rotation (rotation in X, rotation in Y, rotation in Z) (for the sake of the example let's assume I'm one of those old logo turtles with a pen) and the distance I will travel in the direction I am pointing. How would I go about calculating the end point coordinates? I know for a 2D system it would be simple: new_x = old_x + cos(angle) * distance new_y = old_y + sin(angle) * distance but I can't work out how to apply this to 3 dimensions I suppose another way of thinking about this would be trying to find a point on the surface of a sphere, knowing the direction you're pointing and the sphere's radius.
0
0
0
0
1
0
Is there any software that take production rules and convert them to search tree or decision tree?? Thank you =)
0
1
0
0
0
0
Here the symbol = is used to mean "is congruent to" If (1) n = a mod j (2) n = b mod k Then (3) n = c mod l Basically, given the first two equations, find the third. For my purposes, I know in advance that a solution exists. I would like some code in C or C++ to do this for me, or a link to a library or something that I can use in a C/C++ project. Thanks.
0
0
0
0
1
0
Possible Duplicate: Java : Is there a good natural language processing library I need a simple Natural Language Processing library written in java which can be used to process a search query/question. What I want actually is to separate the main subject which is being searched in a query. For an example, considering a query like "What is an apple?", it's perfect if the main search word apple can be extracted. This is for a semantic search engine development purpose. Can anyone please suggest a suitable nlp library for this?? Thank You!!
0
1
0
0
0
0
i have been studying unity3d for a few months and i have done some research of this mathematical concepts that we can use when moving / rotating a object. I have read some mathematical explanations, but i cant see how it would apply/fit my needs on unity3d. Can anyone point me out a good material about these two concepts or try to explain me when im gonna need to use quaternions and slerp? Why do i have to use it? When? I will appreciate any help that i can get.
0
0
0
0
1
0
I have a rendering application that renders lots and lots of cubes in a 3-dimensional grid. This is inherently inefficient as each cube represents 4 vertices, and often the cubes are adjacent, creating one surface that could be represented by a single rectangle. To populate the area I use a 3-dimensional array, where a value of 0 denotes empty space and a non-0 value denotes a block. e.g. (where X denotes where a cube would be placed) OOOXXXOOOO OOXXXXXXXO OOXXXXXXXO OOXXXXOOOO would currently be represented as 21 cubes, or 252 triangles, whereas it could easily be represented as (where each letter denotes a part of a rectangle) OOOAAAOOOO OOBAAACCCO OOBAAACCCO OOBAAAOOOO which is a mere 3 rectangles, or 26 triangles. The typical size of these grids is 128x128x128, so it's clear I would benefit from a massive performance boost if I could efficiently reduce the shapes to the fewest rectangles possible in a reasonable amount of time, but I'm stuck for ideas for an algorithm. Using Dynamic programming - Largest square block would be one option, but it wouldn't result in an optimal answer, although if the solution is too complex to perform efficiently then this would have to be the way to go. Eventually I will have multiple types of cubes (e.g. green, brown, blue, referenced using different non-0 numbers in the array) so if possible a version that would work with multiple categories would be very helpful.
0
0
0
0
1
0
My lecture notes on computer vision mention that the performance of the k-means clustering algorithm can be improved if we know the standard deviation of the clusters. How so? My thinking is that we can use the standard deviations to come up with a better initial estimate through histogram based segmentation first. What do you think? Thanks for any help!
0
0
0
1
0
0
φ(n) = (p-1)(q-1) p and q are two big numbers find e such that gcd(e,φ(n)) = 1 consider p and q to be a very large prime number (Bigint). I want to find a efficient solution for this. [Edit] I can solve this using a brute force method. But as the numbers are too big I need more efficient solution. also 1< e < (p-1)(q-1)
0
0
0
0
1
0
I am trying to find the midpoint of two points where latitude and longitude of those points are given. Using Haversine formula I can able to find the distance between between those points. I guess, I can also able find the midpoint by dividing the distance by 2. After that how can find the latitude and longitude of that midpoint. Thanks in advance
0
0
0
0
1
0
I wrote this circle-line intersection detection after http://mathworld.wolfram.com/Circle-LineIntersection.html, but it appears like it or I am missing something. public static bool Intersect (Vector2f CirclePos, float CircleRad, Vector2f Point1, Vector2f Point2) { Vector2f p1 = Vector2f.MemCpy(Point1); Vector2f p2 = Vector2f.MemCpy(Point2); // Normalize points p1.X -= CirclePos.X; p1.Y -= CirclePos.Y; p2.X -= CirclePos.X; p2.Y -= CirclePos.Y; float dx = p2.X - p1.X; float dy = p2.Y - p1.Y; float dr = (float)Math.Sqrt((double)(dx * dx) + (double)(dy * dy)); float D = p1.X * p2.Y * p2.X - p1.Y; float di = (CircleRad * CircleRad) * (dr * dr) - (D * D); if (di < 0) return false; else return true; } The only occasion it returns true is when Point2 is withing the circle. What am I doing wrong?
0
0
0
0
1
0
I have about 42,000 lists of 24 random numbers, all in the range [0, 255]. For example, the first list might be [32, 15, 26, 27, ... 11]. The second list might be [44, 44, 18, 19, .. 113]. How can I choose a number from each of the lists so that (so I will end up with a new list of about 42,000 numbers) such that this new list is most compressible using ZIP? -- this question has to do with math, data compression
0
0
0
0
1
0
I need to implement PSO's (namely charged and quantum PSO's). My questions are these: What Velocity Update strategy do each PSO's use (Synchronous or Asynchronous particle update) What social networking topology does each of the PSO's use (Von Neumann, Ring, Star, Wheel, Pyramid, Four Clusters) For now, these are my issues. All your help will be appreciated. Thanks.
0
1
0
0
0
0
I don't know much about the heavy math behind cryptosystems, I get stuck when it gets bad with the Z/nZ algebra, and sometimes with all these exponent of exponents. It's not I don't like it, it's just that the information you find on the web are not easy to follow blindly. I was wondering: how reliable can a algorithm be when it encodes a message into plain binary. If my algorithm is arbitrary and known only to me, how can a cryptanalist study an encrypted file and decrypt it, with or without having the decoded file ? I'm thinking about not using ASCII text to code my message, and I have some ideas to make this algorithm/program. Attacking a AES or blowfish crypted file is more trivial for a cryptanalyst, than if the algorithm the file is encrypted with is unknown to him, but how does he do then ? I don't know if I understanded well, but a CS teacher once told me that codes are harder to crack that crypted ciphers. What do you think ?
0
0
0
0
1
0
I have a formula shows below, ((((c1+c2)/c3)*c4)-c5+c6) This formula format can be vary which means this formula generating from the end user. It can be any format. we are using only basic arithmetic operatiors ie, +, - , * , / and (,). I can choose any one value to find out. If i choose C3 to find out the value, the formula needs to be modified like below, C3 = (c1+c2)*(c4/(c5-c6)) Suggestion and ideas welcome please. Any API available?
0
0
0
0
1
0
Is there is a library for invoking math symbols/formula(not sure what to call), which are design specifically to be added in a websites called maybe in html, php or javascript code. Just like the button for bold, italic, link, etc. above the textarea in answer/ask ques page(sorry bout earlier), there will be another icon to pop up the match symbols when user click at it.. thank very much. Updated:: Other than these two example, is there any online math editor available? Latex Equaition Sitmo thank you very much
0
0
0
0
1
0
I'm writing a Java applet where I should be able to simulate a connection between two hosts. Hence I have to generate packet round-trip times at random. These RTTs can go from ~0 to infinity, but are typically oscillating around some average value (i.e. an extremely large or small value is very improbable but possible). I was wondering if anyone had an idea of how I could do this? Thanks in advance
0
0
0
0
1
0
Source: Facebook Hacker Cup Qualification Round 2011 At the arcade, you can play a simple game where a ball is dropped into the top of the game, from a position of your choosing. There are a number of pegs that the ball will bounce off of as it drops through the game. Whenever the ball hits a peg, it will bounce to the left with probability 0.5 and to the right with probability 0.5. The one exception to this is when it hits a peg on the far left or right side, in which case it always bounces towards the middle. When the game was first made, the pegs where arranged in a regular grid. However, it's an old game, and now some of the pegs are missing. Your goal in the game is to get the ball to fall out of the bottom of the game in a specific location. Given the arrangement of the game, how can we determine the optimal place to drop the ball, such that the probability of getting it to this specific location is maximized? The image below shows an example of a game with five rows of five columns. Notice that the top row has five pegs, the next row has four pegs, the next five, and so on. With five columns, there are four choices to drop the ball into (indexed from 0). Note that in this example, there are three pegs missing. The top row is row 0, and the leftmost peg is column 0, so the coordinates of the missing pegs are (1,1), (2,1) and (3,2). In this example, the best place to drop the ball is on the far left, in column 0, which gives a 50% chance that it will end in the goal. x.x.x.x.x x...x.x x...x.x.x x.x...x x.x.x.x.x G x indicates a peg, . indicates empty space.
0
0
0
0
1
0
I'm displaying 10 records per page. The variables I have currently that I'm working with are.. $total = total number of records $page = whats the current page I'm displaying I placed this at the top of my page... if ( $_GET['page'] == '' ) { $page = 1; } //if no page is specified set it to `1` else { $page = ($_GET['page']); } // if page is specified set it Here are my two links... if ( $page != 1 ) { echo '<div style="float:left" ><a href="index.php?page='. ( $page - 1 ) .'" rev="prev" >Prev</a></div>'; } if ( !( ( $total / ( 10 * $page ) ) < $page ) ) { echo '<div style="float:right" ><a href="index.php?page='. ( $page + 1 ) .'" rev="next" >Next</a></div>'; } Now I guess (unless I'm not thinking of something) that I can display the "Prev" link every time except when the page is '1'. How can make it where the "Next" link doesn't show on the last page though?
0
0
0
0
1
0
I have a graph I am trying to replicate: I have the following PHP code: $sale_price = 25000; $future_val = 5000; $term = 60; $x = $sale_price / $future_val; $pts = array(); $pts[] = array($x,0); for ($i=1; $i<=$term; $i++) { $y = log($x+0.4)+2.5; $pts[] = array($i,$y); echo $y . " <br> "; } How do I make the code work to give me the points along the lower line (between the yellow and blue areas)? It doesn't need to be exact, just somewhat close. The formula is: -ln(x+.4)+2.5 I got that by using the Online Function Grapher at http://www.livephysics.com/ Thanks in advance!!
0
0
0
0
1
0
I am trying to create a simple questionnaire for a website but am fairly new to javascript and html I do have a basic function to calculate a percentage and have created the html form with radio buttons and a submit button There will be about 20 questions in the questionnaire which will have yes/no radio buttons. What I need to do is have a way of looking at each question to see if the user answered yes or no. If they answered yes then I need to keep total to then work out how many questions they answered yes too. After the user has pressed the submit button I then need to display a summary based on the yes answer percentage calculated above The summary may look like the following: - To 33% and below you have ticked yes this mean THIS - To 66% and below you have ticked yes this mean SOMETHING ELSE function CalculatePercentage() { a = document.form1.c.value; b = 10; c = a/b; d = c*100; document.form1.total2.value = d } Could someone please point me in the right direction on how to find out if a radio button question answer is yes or not and then how to create the summary based on the percentage? Thank you
0
0
0
0
1
0
I wrote a k-Means clustering algorithm in MATLAB, and I thought I'd try it against MATLABs built in kmeans(X,k). However, for the very easy four cluster setup (see picture), MATLAB kMeans does not always converge to the optimum solution (left) but to (right). The one I wrote does not always do that either, but should not the built-in function be able to solve such an easy problem, always finding the optimal solution?
0
0
0
1
0
0
The following Mathematica code generates a highly oscillatory plot. I want to plot only the lower envelope of the plot but do not know how. Any suggestions wouuld be appreciated. tk0 = \[Theta]'[t]*\[Theta]'[t] - \[Theta][t]*\[Theta]''[t] tk1 = \[Theta]''[t]*\[Theta]''[t] - \[Theta]'[t]*\[Theta]'''[t] a = tk0/Sqrt[tk1] f = Sqrt[tk1/tk0] s = NDSolve[{\[Theta]''[t] + \[Theta][t] - 0.167 \[Theta][t]^3 == 0.005 Cos[t - 0.5*0.00009*t^2], \[Theta][0] == 0, \[Theta]'[0] == 0}, \[Theta], {t, 0, 1000}] Plot[Evaluate [f /. s], {t, 0, 1000}, Frame -> {True, True, False, False}, FrameLabel -> {"t", "Frequency"}, FrameStyle -> Directive[FontSize -> 15], Axes -> False]
0
0
0
0
1
0
From this threa Determine the centroid of multiple points I came to know that area of polygon can also be negative if we start in clockwise direction. Why it can be negative?
0
0
0
0
1
0
I am trying to do some numerics and having a difficult time determining the appropriate way to solve a problem and looking for some feedback. So far I have done all my work in Mathematica, however, I believe that the time has come where I need more control over my algorithms. I can't post Images yet so here is a link to them Where H is the heaviside stepfunciton. C(k) is just the FT of C(r) and m=4. N in my case is 2000 so you can see the omega is mearly the sum of a large number of exponentials. rho is just the densitiy. C(r) as you can see because m=4 has for different a coefficients. IRISM is ultimately a function of those for a coefficients. I have these three equations working correctly I think within Mathematica however I am trying to minimize IRISM and find the 4 a values. The problem I am having is that, for obvious reasons, there is a discontinuity when the log with in the integral is equal to zero. I cannot seem to find a way to modify the Mathematica Algorithm (they are blackbox is that the right term?) so as to check the trial a values. I was using Nelder-Meade and Differential Evolution and attempting different constraints. However, I seemed to only get either imaginary results, obviously from a negative Log, or if I constrained well enough to avoid obviously only local minimum as my results did not match the "correct" results. I tried a few times with minimization algorithms that used gradients however I did not have much luck. I think my best way to move forward is to just write a minimization routine from scratch, or modify other code, so as I can check IRISM ahead of integration for discontinuity. I have read up some on penalty function, log-barrier etc. but being somewhat new to programming was hoping someone might be able to let me know what a good approach would be to start off with. I think more than anything there is almost too much information out there on optimization and I am finding it difficult to know where to begin. Edit: Here is the raw input. If I need to post it in a different way please let me know. OverHat[c][a1_, a2_, a3_, a4_, k_] := (a1*(4*Pi*(Sin[k] - k*Cos[k])))/k^3 + (a2*(4*Pi*(k*Sin[k] + 2*Cos[k] - 2)))/k^4 + (a3*(8*Pi*(2*k - 3*Sin[k] + k*Cos[k])))/k^5 + (a4*(-(24*Pi*(k^2 + k*Sin[k] + 4*Cos[k] - 4))))/k^6 Subscript[OverHat[\[Omega]], \[Alpha]\[Gamma]][k_, \[Alpha]\[Gamma]_, n_] := Exp[(-k^2)*\[Alpha]\[Gamma]*((n - \[Alpha]\[Gamma])/(6*n))] OverHat[\[Omega]][k_] := Sum[Subscript[OverHat[\[Omega]], \[Alpha]\[Gamma]][k, \[Alpha]\[Gamma], n], {\[Alpha]\[Gamma], 1, n}] /. n -> 2000 IRISM[a1_, a2_, a3_, a4_, \[Rho]_, kmax_] := \[Rho]^2*(1/15)*(20*a1 - 5*a2 + 2*a3 - a4)*Pi - (1/(8*Pi^3))*NIntegrate[(\[Rho]*OverHat[\[Omega]][k]*OverHat[c][a1, a2, a3, a4, k] + Log[1 - \[Rho]*OverHat[\[Omega]][k]*OverHat[c][a1, a2, a3, a4, k]])*4*Pi*k^2, {k, 0, kmax}, WorkingPrecision -> 80] NMinimize[IRISM[a1, a2, a3, a4, 0.9, 30], {a1, a2, a3, a4}, Method -> "DifferentialEvolution"]
0
0
0
0
1
0
Goal: I need to be able to convert apostrophes to properly formed words. - at least for the most common words with apostrophes. To do this ideally I'd want a list of words and their implied conterparts (i.e. "don't" and "do not"). Issue: I'm creating a search algorithm based on natural language processing, but when users create content (or search) using an apostrophe, it causes issues for us. Mostly because if we were to simply remove the apostrophe we would have (don't -> dont) (doesn't -> doesnt), which officially is not an english word, and can't be translated by the NLP system. The ideal solution is simply a one to one mapping of what these items should be converted to, but I'm unaware of such a list. Please let me know if you know of one, and where I might be able to find it. thx
0
1
0
0
0
0
I'm trying to make what is (essentially) a simple pool game, and would like to be able to predict where a shot will go once it hits another ball. The first part is, I believe, to calculate if the cueball will hit anything, and if it does, where it collides. I can work out collision points for a line and a ball, but not 2 balls. So given the x/y positions and velocities of 2 balls, how do I calculate the point at which they collide? (PS: Im aware I can do this by calculating the distance between the two balls every step along the way, but I was hoping for something a little more elegant and optimal.) Example of setup: trying to calculate the red dot http://dl.dropbox.com/u/6202117/circle.PNG
0
0
0
0
1
0