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 want to implement math function power to double, can you advice algorithm for this?
I've reviewed sources of Java ME Open Source Software - Math but I want to implement it from the scratch.
Thank you!
| 0
| 0
| 0
| 0
| 1
| 0
|
Thanks for reading my question. I have a CSV file, I read it and store it in a variable.
Now i just want to PLUS all the column to see its sum.
For example
3,34
12,673
23,8543
SUM
-------------
965,12658
Columns and rows can be N limit. Looks easy but don't know, its taking my all time.
Please do let me know which data structure should I use? Or if you can tell me some
steps to solve this problem.
Thanks !
| 0
| 0
| 0
| 0
| 1
| 0
|
I am reading Elements of Statistical Learning ESLII and in chapter 2, they have a gaussian mixture data set to illustrate some learning algorithms. To generate this data set, they first generate 10 means from a bivariate gaussian distribution N((1,0)', I). I am not sure what they mean?
How can you generate 10 means from a bivariate distribution having mean(1,0)?
| 0
| 0
| 0
| 1
| 0
| 0
|
I'm developing a scheduler for an embedded system.
This scheduler will call each process every X milliseconds; this time can be configured separately for each process, of course.
Everything is coded and calls every process as it should; the problem I'm facing is this:
Imagine I set 4 processes to be called every 10, 15, 5 and 30 milliseconds respectively:
A: 10ms
B: 15ms
C: 5ms
D: 30ms
The resulting calling over time will be:
A |
A B A B |
C C C C C C C | processes being called
D |
----------------------------------
0 5 10 15 20 25 30 35... ms
The problem is that when 30ms is reached, all processes are called at the same moment (one after another) and this can delay the correct execution from here.
This can be solved by adding a delay to each process (but preserving its calling frequency), so the frequencies stops being multiples of each other. My problem is that I don't know how to calculate the delay to apply to each process so the number of collisions is minimized.
Is there any known algorithm for this, or some mathematical guidance?
Thank you.
| 0
| 0
| 0
| 0
| 1
| 0
|
My current method allows me to determine the most accurate array but I cannot figure out a good way to display informative results.
Here’s my situation …
I compare X amount of integer arrays to a static integer array. For each position in the array I calculate the position’s accuracy result by comparing to the equivalent position in the static array. After the array’s last position accuracy result has been determined I store the sum of all accuracy results for that array for comparison at a later time.
Once each array’s sum of all accuracy results has been saved they are compared to one another. The array with the lowest sum is deemed the most accurate.
Pseudo code …
foreach (ComparableArray as SingleArray) {
for (i = 0; i < count(SingleArray); i++) {
AccuracyResults[SingleArray] += |StaticArray[i] - SingleArray[i]| / CONSTANT;
}
}
BestArray = AscendingSort(AccuracyResults)[0];
Accuracy is determined by taking the absolute value of the difference of the SingleArray value from the StaticArray and dividing by some constant. If accuracy result is < 1, then the result is deemed accurate. If result > 1, then it is inaccurate and results = 0 are perfect.
Here's a scenario ... let's use two arrays for simplicity
S = [ 56, 53, 50, 64 ]
A = [ 56, 54, 52, 64 ]
B = [ 54, 52, 51, 63 ]
Looping through each array starting with A.
Compare position [1] of A(56) and S(56) for accuracy.
Determine accuracy (I'll use two for my constant)
|56-56|=0, 0 / 2 = 0; Perfect accuracy
Continue to compare each position and compute accuracy
|53-54|=1, 1 / 2 = 0.5; Accuracte because <= 1
|50-52|=2, 2 / 2 = 1; Accurate
|64-64| = 0; Perfect
Now compute the sum of all accuray results for array A
0 + 0.5 + 1 + 0 = 1.5
If we do the same operations for array B the final result will be
1 + 0.5 + 0.5 + 0.5 = 2.5
Now if we compare array A to B we can see that array A is more accurate than B because the sum is lower.
The problem is 1.5 and 2.5 are not very meaningful when trying to display how much more accurate A is to B.
What would be the best method to display these results?
I thought about displaying percentages … such as A is 17% better than B. Or the BestArray is 6% better than average.
How would I compute those results?
Do you see any logic problems in my way of computing accuracy or know of a better way?
Thanks for any insight you can provide!
| 0
| 0
| 0
| 0
| 1
| 0
|
I have an issue that I can't quite seem to find a starting point on; I'm not even sure I can describe it well enough to get an answer.
I need to find the normal of an equilateral triangle in 3D space without knowing the points of the triangle beforehand. Think about taking a photo of a triangular "yield" street sign from any angle, and determining the out-facing normal of the sign from that photo. (I'm not doing that, exactly, but similar - so I'll use the sign/photo metaphor from here on).
** UPDATE **: This same question came up the day before I asked my version, which you can view here. Thanks to BlueRaja for pointing me there. I think the discussion there will answer the question. However, a computational approach is presented below which is also very interesting.
I know how to find the normal of a triangle when I create the triangle in code, but am unsure of how to map points to the triangle in the photo in 3D. I know the length of each side, so I know how far apart the points should be in any orientation. I can build an interactive tool that I can overlay a triangle and rotate it into location and get the points from that, but I need to do this without interaction. Doing that also doesn't help me figure out the math involved.
I'm not even sure I need to determine the points as much as just finding the correct rotation matrix.
I'm just not able to figure out where to start... Searches for the concept come up empty or just not what I'm looking to do (e.g.: they are 2D transforms not 3D)
It's also possible I'm overly complicating things and there is a simple transform equation that would do this in its sleep.
Thoughts? Thanks in advance!
| 0
| 0
| 0
| 0
| 1
| 0
|
I have the following function that I am so close to cracking but can't find a mod function in obj-c. I hope someone can help suss this.
-(void)estimatePosition{
float lat1 = 50.000;
float lon1 = -1.666;
float d = 500;
float tc = 90;
float lat;
float dlon;
float lon;
lat =asin(sin(lat1)*cos(d)+cos(lat1)*sin(d)*cos(tc));
dlon=atan2(sin(tc)*sin(d)*cos(lat1),cos(d)-sin(lat1)*sin(lat));
lon=mod(lon1-dlon +M_PI,2*M_PI )-M_PI;
}
| 0
| 0
| 0
| 0
| 1
| 0
|
Simple online games of 20 questions powered by an eerily accurate AI.
How do they guess so well?
| 0
| 1
| 0
| 0
| 0
| 0
|
Are there any good Java libraries with prebuilt dictionaries that I can use to try and extract word roots from input words?
I asked a more general question which supersedes this question. It is here. Please vote to close this question.
| 0
| 1
| 0
| 0
| 0
| 0
|
After performing a cluster analysis to my dataset (a dataframe named data.matrix), I added a new column, named cluster, at the end (col 27) containing the cluster name that each instance belongs to.
What I want now, is a representative instance from each cluster. I tried to find the instance having the smallest euclidean distance from the cluster's centroid (and repeat the procedure for each one of my clusters)
This is what I did. Can you think of other -perhaps more elegant- ways? (assume numeric columns with no nulls).
clusters <- levels(data.matrix$cluster)
cluster_col = c(27)
for (j in 1:length(clusters)) {
# get the subset for cluster j
data = data.matrix[data.matrix$cluster == clusters[j],]
# remove the cluster column
data <- data[,-cluster_col]
# calculate the centroid
cent <- mean(data)
# copy data to data.matrix_cl, attaching a distance column at the end
data.matrix_cl <- cbind(data, dist = apply(data, 1, function(x) {sqrt(sum((x - cent)^2))}))
# get instances with min distance
candidates <- data.matrix_cl[data.matrix_cl$dist == min(data.matrix_cl$dist),]
# print their rownames
print(paste("Candidates for cluster ",j))
print(rownames(candidates))
}
| 0
| 0
| 0
| 1
| 0
| 0
|
I've found functions which follow the pattern of 1 / bc produce nice curves which can be coupled with interpolation functions really nicely.
The way I use the function is by treating 'c' as the changing value, i.e. the interpolation value between 0 and 1, while varying b for 'sharpness'. I use it to work out an interpolation value between 0 and 1, so generelly the function I use is as such:
float interpolationvalue = 1 - 1/pow(100,c);
linearinterpolate( val1, val2, interpolationvalue);
Up to this point I've been using a hacked approach to make it 'work' since when interpolation value = 1 the value is very close to but not quite 0.
So I was wondering, is there a function in the form of or one which can reproduce similar curves to the ones produced by 1 / bc where at c = 0 result = 1 and c = 1 result = 0.
Or even C = 0, result = 0 and C = 1 result = 1.
Thanks for any help!
| 0
| 0
| 0
| 0
| 1
| 0
|
Using C#:
How do I get the (x, y) coordinates on the edge of a circle for any given degree, if I have the center coordinates and the radius?
There is probably SIN, TAN, COSIN and other grade ten math involved... :)
| 0
| 0
| 0
| 0
| 1
| 0
|
I'm creating a word search and am trying to calculate quality of the generated puzzles by verifying the word set is "distributed evenly" throughout the grid. For example placing each word consecutively, filling them up row-wise is not particularly interesting because there will be clusters and the user will quickly notice a pattern.
How can I measure how 'evenly distributed' the words are?
What I'd like to do is write a program that takes in a word search as input and output a score that evaluates the 'quality' of the puzzle. I'm wondering if anyone has seen a similar problem and could refer me to some resources. Perhaps there is some concept in statistics that might help? Thanks.
| 0
| 0
| 0
| 0
| 1
| 0
|
I am pulling a set of numbers from a MySQL database and am trying to do some simple math on them to calculate a total price to put into an invoice, but PHP isn't cooperating. I thought it might be a type-coercion issue, so I tried adding some intval and floatval calls, but still the total always comes out to 0.
Here is the relevant code.
$totalSum = 0;
$parts = $db->select("*", "WHERE record_id=$id", "recordparts");
foreach($parts as &$part) {
$part['priceTotal'] = (floatval($part['price']) * intval($price['quantity'])) + (floatval($part['laborTime']) * floatval($price['laborRate']));
$totalSum += $part['priceTotal'];
}
$record['parts'] = $parts;
$record['partsSum'] = $totalSum;
And here are the results of the above operation
parts => Array (1)
0 => Array (8)
id => "18"
partNumber => "92-000001"
record_id => "17"
price => "11.5"
laborTime => "2"
laborRate => "65"
quantity => "1"
priceTotal => 0
partsSum => 0
| 0
| 0
| 0
| 0
| 1
| 0
|
So I have a 3D Plane described by 2 Vectors:
P : a point which lies on the Plane
N : the surface normal for the Plane
And i have a very large, flat square Polygon, which I want to render to represent this Plane. I can easily translate the polygon to the given point, but then I need to find the proper rotation to apply to make the surface normal actually be the surface normal.
I tried a method mentioned else where which was:
1) Take any none parallel vector (V) to the normal (N), and take the cross product (W1)
2) Take the cross product of (W1) and (N) now (W2) and that is a Vector (V') which lies on the Plane
I then generate a rotation matrix based on (V') laying on the Plane, so that my polygon would be aligned with (V'). that worked, but it's clear that this method is not working correctly as a whole. The Polygon is not perfectly perpendicular to the surface normal.
Any ideas on how to generate the proper rotation?
| 0
| 0
| 0
| 0
| 1
| 0
|
So there is a method for NaN, but divide by zero creates infinity or negative infinity.
There is a method for Infinity (also positive infinite and negative infinity).
What I want is IsARealNumber function that returns true when the value is an expressible number.
Obviously I can write my own...
public bool IsARealNumber(double test)
{
if (double.IsNaN(test)) return false;
if (double.IsInfinity(test)) return false;
return true;
}
but it doesn't seem like I should have to.
| 0
| 0
| 0
| 0
| 1
| 0
|
I am looking to calculate the X and Y points of each point on a polygon, given the number of sides, and the fact that all sides are equal. I would also have the width and height constraints of the entire shape. If it helps any, I would be doing this in Java (most likely using Line2D).
| 0
| 0
| 0
| 0
| 1
| 0
|
I have a problem to detect object in images or video frames.
I have a task that is detect some people or something who enter into the sight of web camera, and then my system will be alarm.
Next step is recognize which kind of thing the object is, in this phase I know use Hough transform to detect line, circle, even rectangle. But when a people come into the sight of camera, people's profile is more complex than line, circle and rectangle. How can i recognize the object is people not a car.
I need help to know that.
thanks in advance
| 0
| 0
| 0
| 1
| 0
| 0
|
Is there any open source code which does similar to MS Photosynth
Photosynth is a potent mixture of two
independent breakthroughs: the ability
to reconstruct the scene or object
from a bunch of flat photographs, and
the technology to bring that
experience to virtually anyone over
the Internet.
Using techniques from the field of
computer vision, Photosynth examines
images for similarities to each other
and uses that information to estimate
the shape of the subject and the
vantage point the photos were taken
from. With this information, we
recreate the space and use it as a
canvas to display and navigate through
the photos.
Providing that experience requires
viewing a LOT of data though—much more
than you generally get at any one time
by surfing someone’s photo album on
the web. That’s where our Seadragon™
technology comes in: delivering just
the pixels you need, exactly when you
need them. It allows you to browse
through dozens of 5, 10, or 100(!)
megapixel photos effortlessly, without
fiddling with a bunch of thumbnails
and waiting around for everything to
load. About this Release
Photosynth comes from a passionate
little startup of two dozen people in
Microsoft Live Labs. We are
scientists, engineers, and designers
working like crazy to deliver on
Photosynth’s promise.
| 0
| 0
| 0
| 1
| 0
| 0
|
I have some question regarding principal component and factor analysis.
For PCA, does it matter whether the eigenvalues are computed from the covariance matrix or the correlation matrix É
And what about FA, are the results of the eigenvalues the same if I use the covariance or the correlation matrix É
| 0
| 0
| 0
| 0
| 1
| 0
|
I have a 16x16 matrix of grayscale values representing handwriting digits. Is there a plot in R that I can use to visualize it?
Matlab has pcolor, I am looking for something along those lines.
pcolor
| 0
| 0
| 0
| 1
| 0
| 0
|
I'm working on a code to do a software skinner (bone/skin animation), and I'm at the "optimization" phase (the skinner works pretty well and skin a 4900 triangles mesh with 22 bones in 1.09 ms on a Core Duo 2 Ghz (notebook)). What I need to know is :
1) Can someone show me the way (maybe with pseudocode) to transform a float3 (array of 3 float) (representing a coordinate) against a float4x3 matrix?
2) Can someone show me the way (maybe with pseudocode) to transform a float3 (array of 3 float) (representing a normal) against a float3x3 matrix?
I ask this as i know that in the skinning process you can avoid to use part of the matrix without getting any change in the animation process. (So to recover some elaboration time)
Thanks!
| 0
| 0
| 0
| 0
| 1
| 0
|
who recommend me a professional computer vision web site so i can ask question in it.
thanks a lot
| 0
| 0
| 0
| 1
| 0
| 0
|
I'm writing a text tag parser and I'm currently using this recursive method to create tags of n words. Is there a way that it can be done non-recursively or at least be optimized? Assume that $this->dataArray could be a very large array.
/**
* A recursive function to add phrases to the tagTracker array
* @param string $data
* @param int $currentIndex
* @param int $depth
*/
protected function compilePhrase($data, $currentIndex, $depth){
if (!empty($data)){
if ($depth >= $this->phraseStart){
$this->addDataCount($data, $depth);
}
if ($depth < $this->phraseDepth){
$currentIndex = $currentIndex + 1;
//$this->dataArray is an array containing all words in the text
$data .= ' '.$this->dataArray[$currentIndex];
$depth += 1;
$this->compilePhrase($data, $currentIndex, $depth);
}
}
}
| 0
| 1
| 0
| 0
| 0
| 0
|
Is there anyway to ensure the that the fewest number of turns heuristic is met by anything except a breadth first search? Perhaps some more explanation would help.
I have a random graph, much like this:
0 1 1 1 2
3 4 5 6 7
9 a 5 b c
9 d e f f
9 9 g h i
Starting in the top left corner, I need to know the fewest number of steps it would take to get to the bottom right corner. Each set of connected colors is assumed to be a single node, so for instance in this random graph, the three 1's on the top row are all considered a single node, and every adjacent (not diagonal) connected node is a possible next state. So from the start, possible next states are the 1's in the top row or 3 in the second row.
Currently I use a bidirectional search, but the explosiveness of the tree size ramps up pretty quickly. For the life of me, I haven't been able to adjust the problem so that I can safely assign weights to the nodes and have them ensure the fewest number of state changes to reach the goal without it turning into a breadth first search. Thinking of this as a city map, the heuristic would be the fewest number of turns to reach the goal.
It is very important that the fewest number of turns is the result of this search as that value is part of the heuristic for a more complex problem.
| 0
| 1
| 0
| 0
| 0
| 0
|
x+2y=8 , 2x+y=14 this are equations this is just example i gave for understanding . from this equation i like to find x,y values using c# program anybody help for me.how can implement this in program?...
| 0
| 0
| 0
| 0
| 1
| 0
|
I have a 256x256 texture in my view frustum that I need to move to a z-position where the texture is replicated on-screen at ACTUAL size.
What I have so far is:
const float zForTrueScale = -((itemSize/2) / tanf(DEGREES_TO_RADIANS(fieldOfView/2)) ) * 2;
where itemSize is the size of my texture in world space (2.0 units). This is to calculate what Z (adjacent) is when itemSize/2 (opposite) is 1.0. I thought this would work.
This formula shows a texture consistently too small by about 10% no matter what FOV I use.
Thanks
EDIT: I am moving around images in 3D space and need a seamless transition to the correct z-distance. I can't use orthagonal projection, it has to be in a view frustum.
| 0
| 0
| 0
| 0
| 1
| 0
|
how can i construct the bezier curve if i only have points in x axis?can i do this act or need points for x and y axes related to t parameter?
i want constructe a bezier curve(from degree N)in a given interval and known point in that interval(that are random), but i have points only in x axes!!Whether this is feasible?
| 0
| 0
| 0
| 0
| 1
| 0
|
This is an odd one I'm puzzled about. I recently noticed at the Gnu Octave prompt, it's possible to enter in negative zeroes, like so:
octave:2> abomination = -0
And it remembers it, too:
octave:3> abomination
abomination = -0
In the interest of sanity, negative zero does equal regular zero. But I also noticed that the sign has some other effects. Like these:
octave:6> 4 * 0
ans = 0
octave:7> 4 * -0
ans = -0
octave:8> 4 / 0
warning: division by zero
ans = Inf
octave:9> 4 / -0
warning: division by zero
ans = -Inf
As one can see, the sign is preserved through certain operations. But my question is why. This seems like a radical departure from standard mathematics, where zero is essentially without sign. Are there some attractive mathematical properties for having this? Does this matter in certain fields of mathematics?
FYI: Matlab, which octave is modeled after, does not have negative zeros. Any attempts to use them are treated as regular zeros.
EDIT:
Matlab does have negative zeros, but they are not displayed in the default output.
| 0
| 0
| 0
| 0
| 1
| 0
|
I would like to take surveys (2 or more choices), and place the results in a table. I just want to know how I would tally up the results in a sql query.
Even more, should i be doing the math within the query, or just use PHP to do the math?
Example
Questions Table
question_id (int)
question (text)
answer_1 (varchar)
answer_2 (varchar)
answer_3 (varchar)
etc...
Answers Table
answer_id (int)
question_id (int)
answer (int) The answer they chose. (1, 2, 3, etc.)
How would/should I tally up the results?
Edit: using MySQL, PHP. The difference between the answers (45% said blah, 50% said blah blah, 5% said bloch). Not for homework, Im EE, not CS
| 0
| 0
| 0
| 0
| 1
| 0
|
I have a couple of questions about searching in graphs/trees:
Let's assume I have an empty chess board and I want to move a pawn around from point A to B.
A. When using depth first search or breadth first search must we use open and closed lists ? This is, a list that has all the elements to check, and other with all other elements that were already checked? Is it even possible to do it without having those lists? What about A*, does it need it?
B. When using lists, after having found a solution, how can you get the sequence of states from A to B? I assume when you have items in the open and closed list, instead of just having the (x, y) states, you have an "extended state" formed with (x, y, parent_of_this_node) ?
C. State A has 4 possible moves (right, left, up, down). If I do as first move left, should I let it in the next state come back to the original state? This, is, do the "right" move? If not, must I transverse the search tree every time to check which states I've been to?
D. When I see a state in the tree where I've already been, should I just ignore it, as I know it's a dead end? I guess to do this I'd have to always keep the list of visited states, right?
E. Is there any difference between search trees and graphs? Are they just different ways to look at the same thing?
| 0
| 1
| 0
| 0
| 0
| 0
|
I am using jama libarary for matrix. I used following matrix but when i tried to get S, it gave me error.
1.0 1.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 11.0 1.0
1.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 12.0 2.0
1.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 13.0 3.0
When I tried to get S it produce following error.
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 4
at Jama.SingularValueDecomposition.getS(SingularValueDecomposition.java:507)
at SVD2.main(SVD2.java:19)
Here is the code
public class SVD2 {
public static void main(String[] args) {
double[][] vals = {
{1,1,0,1,0,0,0,0,0,11,1},
{1,0,0,0,0,0,1,0,0,12,2},
{1,1,0,0,0,0,0,0,1,13,3}
};
Matrix A = new Matrix(vals,3,11);
System.out.println("The Matrix A is ");
A.print(11, 2);
System.out.println();
System.out.println("The SVD of A is ");
SingularValueDecomposition svd = A.svd();
Matrix S = svd.getS();
}
}
| 0
| 0
| 0
| 0
| 1
| 0
|
this is a picture of a dog's contour and a horse's contour
alt text http://www.tlnews.cn/forum/attachments/month_0810/20081024_2f055de790b83aced18atjm8EVN4Gyay.jpg
how to make computer know it is a horse or a dog or a person.
alt text http://www.pocketgo.com.cn/upload/2008-10/122465306490637600.jpg
| 0
| 0
| 0
| 1
| 0
| 0
|
How does:
1 + 2 + ... + N-1 + N
+ N + N-1 + ... + 2 + 1
---------------------------
N+1 + N+1 + ... + N+1 + N+1
equal N(N + 1)? Shouldn't it be 4N + 4 or 4(N + 1)?
| 0
| 0
| 0
| 0
| 1
| 0
|
If this is OT, please tell me where to repost it.
I need to render some math equations, in real time. Where can I find a mapping of the LaTeX "english" names (like \sum ) to symbol XYZ of ABC.ttf ? I can read + render ttf's fine; I just don't know where to get the ttfs that have the math symbols and how they're indexed.
Thanks!
| 0
| 0
| 0
| 0
| 1
| 0
|
Draw two circles which has intersect each other, from that I need to find that intersect point using c# using directx. I need to find two points.
| 0
| 0
| 0
| 0
| 1
| 0
|
I'm having a logic problem here. I want to add the result of the factorial values but I'm not sure how to add them. Here's my code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Task_8_Set_III
{
class Program
{
static void Main(string[] args)
{
for (int i = 1; i <= 7; i++)
{
double c = i / fact(i);
Console.WriteLine("Factorial is : " + c);
Console.ReadLine();
Console.WriteLine("By Adding.. will give " +);
}
}
static double fact(double value)
{
if (value ==1)
{
return 1;
}
else
{
return (value * (fact(value - 1)));
}
}
}
}
| 0
| 0
| 0
| 0
| 1
| 0
|
Lets say I divide 14 / 15 times it by 100 to get the percentage which is 93.33333333333333 how can I display it as 93.3% using php?
Here is the code.
$percent = ($avg / 15) * 100;
| 0
| 0
| 0
| 0
| 1
| 0
|
I am having a problem handling large numbers.
I need to calculate the log of a very large number. The number is the product of a series of numbers. For example: log(2x3x66x435x444) though my actual series are longer.
I am getting a math overflow because product grows very large, very quickly.
Are there special math libraries to handle huge numbers? Any ideas how I can solve this?
| 0
| 0
| 0
| 0
| 1
| 0
|
Im having a trouble with the flex calculation, im trying to transform a pixel value to mm and reversing it.
Starting out with 69.8:
Calculating MM to pixel from: 69.8 mm
69.8*300 = 20940
20940 / 2.54 = 8244.094488188975
8244.094488188975 / 10 = 824.4094488188975
And calculating back:
Calculating pixel to MM from: 824.4094488188975
824.4094488188975/300 = 2.7480314960629917
2.7480314960629917 * 2.54 = 6.979999999999999
6.979999999999999 * 10 = 69.79999999999998
We wanted 69.8 but ended up with 69.79999999999998.
I tracked the proccess using simple windows calc and the first place it wents wrong is at 20940 / 2.54 = 8244.094488188975 wich should be 8244,094488188976.
Anny help on this would be great.
| 0
| 0
| 0
| 0
| 1
| 0
|
I'd like to get an idea what kind of math is typically necessary for 3D game engine programming? Any specific math (such as vector geometry) or calculation algorithms (such as fast fourier transforms), or is this all abstracted away with DirectX/OpenGL so that highly complex math isn't really necessary any more?
| 0
| 0
| 0
| 0
| 1
| 0
|
I would like to calculate the distance between two x/y coordinates on the surface of a torus. So, this is a normal grid that has the property that its corners and sides are 'connected'. For example, on a grid of 500x500, the point at (499, 499) is adjacent to (0, 0) and the distance between e.g. (0,0) and (0,495) should then be 5.
Is there any good mathematical way of calculating this?
| 0
| 0
| 0
| 0
| 1
| 0
|
Back to the basics...
For reference types, one can do this:
SomeType someObject = firstObject as SomeType;
if (someObject == null)
{
// Handle the situation gracefully
}
else
{
// Do stuff
}
For value types, my understanding is that we have implicit conversions (no data loss), explicit conversions (needed if there's a risk of data loss), the Convert class (a "conversion wrapper" I think) and also type-specific conversions (e.g. double x = Double.Parse("2");), but I haven't found anything similar to the as operator above.
So, my question is: does the framework provide with some method/operator/technique to do something along these lines:
if (!Convert.CanConvert(someValue, someValueType))
{
// Beware! Data loss can occur
}
else
{
// No data loss here
}
If not, can anyone out there suggest a solid approach to build one such CanConvert method?
Thanks a lot!
EDIT(1): The user-case/problem is as follows: Given a something passed by the code's consumer (my other self, but that's irrelevant), (1) Check that something is a number (easy enough) and (2) Place something in the "smallest" numeric type where it fits without incurring in data loss.
Some background: the nature of what I'm trying to do is more mathematical than technical: I'm trying to see if/how I can fit existing numeric types into some sort of an algebraic hierarchy of the form Monoid=>Group=>Ring=>Field (or a simplified version thereof). While working on this, and not very sure how, "one thing led to another" and I found myself having to deal with type conversions...
| 0
| 0
| 0
| 0
| 1
| 0
|
Making a simple app for my android.
in my xml interface there is a text box in which the user will input a number (for example: 10). the id of this text box is "input1"
how do I call the value of input1 in java and then perform a calculation on it?
For example...
suppose input1 = x
x + 5 or x*2
and for that matter, how do I have the resulting value appear as constantly updated text output in a specified place on the UI?
| 0
| 0
| 0
| 0
| 1
| 0
|
In my program, I think my count variable is not holding the value. What do I do so that it can hold? here`s my code.
static void Main(string[] args)
{
double a;
double count = 0;
Console.WriteLine("Enter the Numbers : ");
for (double i = 1; i <= 10; i++)
{
a = Convert.ToDouble(Console.ReadLine());
if (a % 2 != 0 || a % 3 != 0 || a % 5 != 0)
{
count = count++;
}
//else
//{
// }
Console.ReadLine();
}
Console.WriteLine("The Numbers That Are divisible by 2,3,5 are : " + count);
Console.ReadLine();
}
| 0
| 0
| 0
| 0
| 1
| 0
|
I've seen in a lot of AI related stuff the symbol <-. For example,
delta <- 0
x <- x + 1
etc.
I always assume its meaning is the same as =(assigment), but probably they have a meaning that's a bit different from assigment, I assume?
Thanks
| 0
| 1
| 0
| 0
| 0
| 0
|
I had to build a concept analyzer for computer science field and I used for this machine learning, the orange library for Python. I have the examples of concepts, where the features are lemma and part of speech, like algorithm|NN|concept. The problem is that any other word, that in fact is not a concept, is classified as a concept, due to the lack of negative examples. It is not feasable to put all the other words in learning file, classified as simple words not concepts(this will work, but is not quite a solution). Any idea?
Thanks.
| 0
| 1
| 0
| 1
| 0
| 0
|
I have an math problem in Isometric projection. I have reading an article: Axonometric projections - a technical overview. For the Isometric projection part, it give an mathematical formula for conversion 3D point into 2D point for the x part the formula is:
x' = ( x − z ) cos(30);
But i also check for wiki for Isometric Projection so i use the rotation matrices which the wiki giving, calculate myself
x' = x*cos(beta) - z*sin(beta)
The beta is define by the wiki(Y axis rotation angle, and it should be 45). So what's wrong with my math? Or is there something that i don't know about the Isometric projection?
| 0
| 0
| 0
| 0
| 1
| 0
|
I need to calculate the overlap (amount or yes/no) that two rectangles make on a special x/y grid. The grid is 500x500 but the sides and corners connect (are continuous). So the next point after 499 becomes 0 again.
In a previous question I asked for a way to calculate the distance between two points in this grid. This turned out to be the Euclidean distance:
sqrt(min(|x1 - x2|, gridwidth - |x1 - x2|)^2 + min(|y1 - y2|, gridheight - |y1-y2|)^2)
What is the good mathematical way of calculating if two rectangles (defined by a point (x,y), width and height) have overlap in this grid?
Rectangle-1 ([x=0,y=0], w=20, h=20) and Rectangle-2 ([x=495,y=0], w=10, h=10) should have overlap. The overlapping rectangle (not really needed but) should be ([x=0,y=0], w=5, h=10)
| 0
| 0
| 0
| 0
| 1
| 0
|
Coding a calculation tool for my android. On of the inputs is distance in Feet and Inches.
I have two inputs (input3 and input4) for feet and inches, respectively. In my calculation I am trying to convert these two inputs to a decimal number to be used in the rest of the equation. Here's the part of my code that does this:
private void doCalculation() {
// Get entered input value
String strValue3 = input3.getText().toString();
String strValue4 = input4.getText().toString();
// Perform a hard-coded calculation
double imperial1 = (Integer.parseInt(strValue3) + (Integer.parseInt(strValue4) / 12));
// Update the UI with the result to test if calc worked
output2.setText("Test: "+ imperial1);
}
My test values are 4 feet, 6 inches. The 4 comes across fine, but the 6 inches defaults to 0 when it is divided by 12. So my result is 4.0 I tried cutting the calculation down to JUST the division operation, and the result was 0.0
What am I doing wrong? (fyi: this is my first time using Java)
| 0
| 0
| 0
| 0
| 1
| 0
|
This should be a very simple question for anyone who has some experience in this area, but I'm still new to this.
I have the following system (or here is an image with better resolution):
alt text http://img199.imageshack.us/img199/2140/equation1.png
Given the following input:
u = min(2 - t/7.5, 2*(mod(t, 2) < 1));
I need to plot the output of system y.
I am describing the system with the following function:
function xprime = func(t, x)
u = min(2 - t/7.5, 2*(mod(t, 2) < 1));
xprime = [
x(2);
x(3);
0.45*u - 4*x(3)^2 - x(2)*x(1) - 4*x(2) - 2*x(1);
x(5);
sin(t) - 3*x(5)*x(1);
];
and simulating with ode23, like this:
[tout, xout] = ode23(@func, [0 15], [1.5; 3; -0.5; 0; -1])
After the simulation, xout will have five columns. My question is: how do I know which one is the output of the y system?
EDIT: Ok, so to put it simple, I'd like to plot the solution like this:
a = 1 % what goes here? 1, 2, 3, 4 or 5?
plot(tout, xout(:,a))
| 0
| 0
| 0
| 0
| 1
| 0
|
I try to determine the angle from a point (n,m) to (0,0). Without arctan2 being available, I'm running into the problem that m can be 0, which leads to a possible division by zero.
What would be an elegant, correct solution to tackling this issue?
| 0
| 0
| 0
| 0
| 1
| 0
|
Ok - I have someone I work with who has written somthing like this
if()
if()
if()
if()
if()
I dont like this!!
If there are ten different boolean flags how many combinations are there?
10 factorial?
I am trying to explain why this is bad
| 0
| 0
| 0
| 0
| 1
| 0
|
I am working on a C# 2d soft body physics engine and I need to assign masses to an object's vertices given: a list of vertices (x,y positions), the total mass for the object, and the center of mass.
The center of mass is given as:
where,
R = center of mass
M = total mass
mj = mass of vertex j
rj = position of vertex j
I need an algorithm that can approximate each mj given R, M, and rj.
edit: I just want to clarify that I am aware that there are an infinite set of solutions. I am looking for a quick algorithm that finds a set of mj's (such that they are each sufficiently close to mj = M/[number of vertices] and where "sufficiently" is defined as some small floating point threshold).
Also, each object will consist of about 5 to 35 points.
| 0
| 0
| 0
| 0
| 1
| 0
|
My problem is this:
I have a set of points in 3D space, and their positions are updated from time to time with a certain velocity. But i need to keep a minimal distance between them.
Can you help me with this?
EDIT: I am using C for the implementation of the algorithm.
Thanks in advance.
| 0
| 0
| 0
| 0
| 1
| 0
|
import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.SpinnerAdapter;
import android.widget.TextView;
public class calctest extends Activity {
/** Called when the activity is first created. */
private EditText input;
private EditText input2;
private EditText input3;
private EditText input4;
private TextView output;
private TextView output2;
private Spinner aperture;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Extract the text fields from the XML layout
input = (EditText) findViewById(R.id.input1);
input2 = (EditText) findViewById(R.id.input2);
input3 = (EditText) findViewById(R.id.input3);
input4 = (EditText) findViewById(R.id.input4);
output = (TextView) findViewById(R.id.result);
output2 = (TextView) findViewById(R.id.result2);
//aperture dropdown
final Spinner aperture = (Spinner) findViewById(R.id.apt);
ArrayAdapter adapter = ArrayAdapter.createFromResource(
this, R.array.apertures, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
aperture.setAdapter(adapter);
Spinner mode = (Spinner) findViewById(R.id.mode);
ArrayAdapter adapter2 = ArrayAdapter.createFromResource(
this, R.array.formats, android.R.layout.simple_spinner_item);
adapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mode.setAdapter(adapter2);
// Perform calculation when button is pushed
final Button button = (Button) findViewById(R.id.calculate);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
doCalculation(aperture.getSelectedItem());
}
});
}
private void doCalculation(Object selectedItem) {
// Get entered input value
String cinput1 = input.getText().toString();
String cinput2 = input2.getText().toString();
String cinput3 = input3.getText().toString();
String cinput4 = input4.getText().toString();
Object cinput5 = aperture.getSelectedItem();
}
}
I know that the doCalculation method isnt actually calculating anything yet, because the app crashes just from trying to get the input's value. If I disable the cinput5 line, it works just fine. What am I doing wrong here? And on that note, how do I convert the spinner's value to a string to use in the calculation?
Also, as a double check... the spinner displays a list of numbers (1.4, 2, 2.8, 4, 5.6, etc) and whichever number is selected is the number I need to use in the calculation. I'm calling the correct value from the spinner, right?
I apologize for the probably extremely obvious errors. I just started Java and after I finish this app is promise I will be getting a book!
| 0
| 0
| 0
| 0
| 1
| 0
|
I would like to have some kind of project-wide fail fast mechanism (maybe a RuntimeException) for any code that causes assignment of NaN.
In my project NaN is never a valid value.
I realise I could add asserts (using isNaN) or other tests throughout but I want to know if there is a more elegant way.
| 0
| 0
| 0
| 0
| 1
| 0
|
I'm primarily a Flash AS3 dev, but I'm jumping into openframeworks and having trouble using 3D (these examples are in AS)
In 2D you can simulate an object orbiting a point by using Math.Sin() and Math.cos(), like so
function update(event:Event):void
{
dot.x = xCenter + Math.cos(angle*Math.PI/180) * range;
dot.y = yCenter + Math.sin(angle*Math.PI/180) * range;
angle+=speed;
}
I am wondering how I would translate this into a 3D orbit, if I wanted to also orbit in the third dimension.
function update(event:Event):void
{
...
dot.z = zCenter + Math.sin(angle*Math.PI/180) * range;
// is this valid?
}
An help is greatly appreciated.
| 0
| 0
| 0
| 0
| 1
| 0
|
Backpropagation calculates dW (weight delta) per weight per pattern, so it's straightforward how to modify weights when doing stochastic training. How do I use it for batch training, though? Simply accumluate dW over the entire training set and then apply the modfication, or is there more to it?
| 0
| 0
| 0
| 1
| 0
| 0
|
If I have a decimal, how do I get a string version of it with two decimal places? This isn't working:
Math.Round(myDecimal, 2).ToString("{0.00}");
| 0
| 0
| 0
| 0
| 1
| 0
|
I'm designing architecture of a text parser. Example sentence: Content here, content here.
Whole sentence is a... sentence, that's obvious. The, quick etc are words; , and . are punctuation marks. But what are words and punctuation marks all together in general? Are they just symbols? I simply don't know how to name what a single sentence consists of in the most reasonable abstract way (because one may write it consists of letters/vowels etc).
Thanks for any help :)
| 0
| 1
| 0
| 0
| 0
| 0
|
I asked this question about 2 months ago but found none of the answers to be helpful enough. So I am giving it another shot. I think it was my fault not describing it well enough. So lets try again.
(source: bja888.com)
Here is a rough idea of what I am trying to accomplish.
The goal is to send a projectile from point T to intercept the object represented by point R.
What is known:
The location of object R
The direction object R is traveling
The speed at which object R is traveling
The location of object T
Speed at which object T will travel
I am looking for the direction object T should be sent and thus find the location they will collide at. Either one.
For example: If...
The location of R was (1,5)
R is traveling at a 45 degree angle (relative to d)
R is traveling at 1 unit per second
T is located at (1,1)
T also travels at 1 unit per second
(source: bja888.com)
L makes the location of the collision at (3,3)
| 0
| 0
| 0
| 0
| 1
| 0
|
I'm doing a Natural Language Processing project where I compute a bunch of attributes of a text, giving me a vector of values for each text. I want to compare these vectors with multidimensional scaling. What Java libraries/toolkits do you recommend for doing this?
| 0
| 1
| 0
| 0
| 0
| 0
|
import java.lang.Math;
import java.awt.*
public class Triangle implements Shape
{
java.awt.Point a;
java.awt.Point b;
java.awt.Point c;
public Triangle(java.awt.Point a, java.awt.Point b, java.awt.Point c)
{
this.a = a;
this.b = b;
this.c = c;
}
public double getArea( )
{
double area;
return area = Math.abs((a-c)*(b-a)-(a-b)*(c-a));
} ...
http://upload.wikimedia.org/math/f/e/5/fe56529cdaaaa9bb2f71c1ad8a1a454f.png <--area formula
I am trying to calculate the area of a triangle from 3 points (x,y) from a 2D Cartesian coordinate system. I'm assuming that my above formula correctly yields the area of a triangle (if not, please correct me) but my compiler says "operator - cannot be applied to java.awt.Point,java.awt.Point". I'm assuming it's saying this because you cannot subtract points from each other, but each value in the formula is either an x or y value, not a point. How can I fix my code so this would work?
Thanks!
| 0
| 0
| 0
| 0
| 1
| 0
|
alt text http://pascallin.ecs.soton.ac.uk/challenges/VOC/voc2007/examples/person_06.jpg
alt text http://pascallin.ecs.soton.ac.uk/challenges/VOC/voc2007/examples/dog_08.jpg
alt text http://pascallin.ecs.soton.ac.uk/challenges/VOC/voc2007/examples/sheep_07.jpg
this picture is download from a website,the team show their research result like this.
I want to know how they did it, some body know tell me I will be appreciate. thank you
| 0
| 0
| 0
| 1
| 0
| 0
|
In Java, (Number/0) throws an ArithmeticException while (Number/0.0) = Infinity.
Why does this happen?
| 0
| 0
| 0
| 0
| 1
| 0
|
Well, after solving this problem by naive STL set,I was reading the forum entries,there I find this entry :
#include <iostream>
#include <cmath>
#define MAX 100
using namespace std;
int main(){
int res=(MAX-1)*(MAX-1);
for(int i=2;i<MAX;i++)
for(int j=i*i;j<=MAX;j=j*i)
res = res-int(MAX*(log(i)/log(j)))+1;
cout<<res<<endl;
return 0;
}
The author's explanation :
Maximum will be 99*99. I subtracted occurrences of those numbers which are powers of some lower numbers (2-100): -
For example: -
4^2,4^3,4^4 (i.e. 3 should be subtracted) as they will be duplicates from lower number powers as in 2^4,2^6,2^8
This program is giving correct answer check here but I am unable to get the implemented logic,to be precise I am not getting how the duplicates are determined. Could somebody help ?
| 0
| 0
| 0
| 0
| 1
| 0
|
I'm trying to figure out some calculations using arcs in 3d space but am a bit lost. Lets say that I want to animate an arc in 3d space to connect 2 x,y,z coordinates (both coordinates have a z value of 0, and are just points on a plane). I'm controlling the arc by sending it a starting x,y,z position, a rotation, a velocity, and a gravity value. If I know both the x,y,z coordinates that need to be connected, is there a way to calculate what the necessary rotation, velocity, and gravity values to connect it from the starting x,y,z coordinate to the ending one?
Thanks.
EDIT: Thanks tom10. To clarify, I'm making "arcs" by creating a parabola with particles. I'm trying to figure out how to ( by starting a parabola formed by a series particles with an beginning x,y,z,velocity,rotation,and gravity) determine where it will in end(the last x,y,z coordinates). So if it if these are the two coordinates that need to be connected:
x1=240;
y1=140;
z1=0;
x2=300;
y2=200;
z2=0;
how can the rotation, velocity, and gravity of this parabola be calculated using only these variables start the formation of the parabola:
x1=240;
y1=140;
z1=0;
rotation;
velocity;
gravity;
I am trying to keep the angle a constant value.
| 0
| 0
| 0
| 0
| 1
| 0
|
How would you find the signed angle theta from vector a to b?
And yes, I know that theta = arccos((a.b)/(|a||b|)).
However, this does not contain a sign (i.e. it doesn't distinguish between a clockwise or counterclockwise rotation).
I need something that can tell me the minimum angle to rotate from a to b. A positive sign indicates a rotation from +x-axis towards +y-axis. Conversely, a negative sign indicates a rotation from +x-axis towards -y-axis.
assert angle((1,0),(0,1)) == pi/2.
assert angle((0,1),(1,0)) == -pi/2.
| 0
| 0
| 0
| 0
| 1
| 0
|
I'm taking my first AI course this semester at uni and we were asked to do a project on any AI topic that we find interesting and to impliment the code in "Prolog". One example is Implementing 4 or 5 search algorithms and comparing the effeciency in different selected special cases. I just need a topic in the same level. plz HELP!
ps. A*, Sales Man, Search Akgorithms are done by other students ..
| 0
| 1
| 0
| 0
| 0
| 0
|
I am VERY new at Prolog I am looking for any beginner material on Prolog. I am very interested in learning the language. Where' s good place to start? Online preferably
I also am having a bit of trouble writing some code. I need to return a sentence but all I am getting is a list of atoms (i believe that's the term)
ex I get [the, cat, is, pretty] When I would really like to get [the cat is pretty].
writelist(X):-
write(X), nl.
How can I turn this atom response into just a normal sentence?
| 0
| 1
| 0
| 0
| 0
| 0
|
Given two points, A and B, defined by longitude and latitude I want to determine if another point C is ~between~ A and B. ~between~ is hard for me to define. I don't mean on the line - it almost certainly won't be.
Geometric diagram http://www.freeimagehosting.net/uploads/b5c5ebf480.jpg
In this diagram, point C is ~between~ A and B because it is between the normals of points A and B and the line between them (normals denoted by thin line). Point D is not ~between~ A and B but it is ~between~ B and F.
Another way of saying this is that I want to determine if the triangles ABC and ABD are obtuse or not.
Note that the points will be very close together - within 10s of metres normally.
I'm thinking that the law of haversines may help but I don't know what the inverse of haversine is.
Many thanks for all help.
| 0
| 0
| 0
| 0
| 1
| 0
|
This is a question I have been toying with for a week or so, proposed by a colleague:
Imagine a game played on a
36x36 grid. The goal of the game is to create four corners of a square of any size (eg., 2x2, 3x3, 4x4, and so on). The first player places a game-piece anywhere except the center four grid spaces. After the first move, players can place their game-piece anywhere on the grid. Game-pieces cannot be moved after they are placed. And that's it; The game is simple and fun.
I have been trying to come up with an algorithm to win, or at least do well at this game. Any suggestions?
| 0
| 1
| 0
| 0
| 0
| 0
|
Given a hypoteneuse (c in the typical equation a*a + b*b = c*c), what is an efficient way to calculate all possible integer values of a and b, such that a < b?
Note: I've seen c be greater than 1e12, thus c*c is greater than long.MaxValue, from what I can tell, c*c does fit into a decimal, though.
| 0
| 0
| 0
| 0
| 1
| 0
|
To understand the problem,let us consider these examples first:
46 = (22)6 = 212 = (23)4 = 84 = 163 = 4096.
Thus,we can say that 46,212,84 and 163 are same.
273 = 39 = 19683
so, both 273 and 39 are identical.
Now the problem is, for any given pair of ab how to compute all others possible (if any)xy where, ab = xy.I am interested in an algorithm that can be efficiently implemented in C/C++.
For example:
If the inputs are like this:
4,6 desired output :(2,12),(8,4)
8,4 desired output :(2,12),(2,6)
27,3 desired output :(3,9)
12,6 desired output :(144,3),(1728,2)
7,5 desired output : No duplicate possible
| 0
| 0
| 0
| 0
| 1
| 0
|
i want to multiply 2 polynomials in gf(2) in c#. please help.
| 0
| 0
| 0
| 0
| 1
| 0
|
I am trying to set a variable based on some maths logic (to wrap specific html around elements).
I worked half the problem, to hit 0, 3, 6, 9, 12
if(($i % 3) == 0) { // blah }
Now I need to hit the following numbers, 2, 5, 8, 11, 14, etc
What possible maths operation could I do to hit this sequence?
| 0
| 0
| 0
| 0
| 1
| 0
|
I have a number of small algorithms that I would like to write up in a paper. They are relatively short, and concise. However, instead of writing them in pseudo-code (à la Cormen or even Knuth), I would like to write an algebraic representation of them (more linear and better LaTeX rendering) . However, I cannot find resources as to the best notation for this, if there is anything: e.g. how do I represent a loop? If? The addition of a tuple to a list?
Has any of you encountered this problem, and somehow solved it?
Thanks.
EDIT: Thanks, people. I think I did a poor job at phrasing the question. Here goes again, hoping I make it clearer: what is the common notation for talking about loops and if-then clauses in a mathematical notation? For instance, I can use $acc \leftarrow acc \cup \langle i,i+1 \rangle$ to represent the "add" method of a list.
| 0
| 0
| 0
| 0
| 1
| 0
|
From http://discuss.joelonsoftware.com/default.asp?interview.11.794054.1
The sequence A is defined as follows:
Start with the natural numbers
1,2,3,...
Initialize count = 1;
while(there are uncrossed numbers)
{
pick the first uncrossed number say n.
set A[count] = n.
Cross out the number count+n.
Cross out the number n
Increment count.
}
Give a fast algorithm to determine A[n], given n.
Try getting an algorithm which is polynomial in log n.
| 0
| 0
| 0
| 0
| 1
| 0
|
Ok so I have bunch of balls:
What I'm trying to figure out is how to make these circles:
Rotate based on the surfaces they are touching
Fix collision penetration when dealing with multiple touching objects.
EDIT: This is what I mean by rotation
Ball 0 will rotate anti-clockwise as it's leaning on Ball 3
Ball 5 will rotate clockwise as it's leaning on Ball 0
Even though solutions to this are universal, just for the record I'm using Javascript and SVG, and would prefer implementing this myself rather than using a library.
Help would be very much appreciated. Thanks! :)
| 0
| 0
| 0
| 0
| 1
| 0
|
Would someone be able to explain to me or point me to some resources of why (or situations where) more than one hidden layer would be necessary or useful in a neural network?
| 0
| 0
| 0
| 1
| 0
| 0
|
I'm building a spelling corrector for search engine queries by implementing the method described in "Spelling correction as an iterative process that exploits the collective knowledge of web users".
The high-level approach is as follows: for a given query, come up with possible correction candidates (words in the query log within a certain edit distance) of each unigram and bigram, then perform a modified Viterbi search to find the most likely sequence of candidates given bigram frequencies. Repeat this process until the sequence is of maximum probability.
The modification to the Viterbi search is such that if two adjacent words are both found in a trusted lexicon, at most one can be corrected. This is especially important for avoiding correction of properly-spelled single-word queries to words of higher frequency.
My question is where to find such a lexicon. It should be in English and contain proper nouns (first/last names, places, brand names, etc) likely to show up in search queries as well as common and uncommon English words. Even a push in the right direction would be useful.
Also, if anyone is reading this and has any suggestions for improvement on the methodology supplied in the paper, I am open to those as well given that this is my first foray into NLP.
| 0
| 1
| 0
| 0
| 0
| 0
|
The need for having part of the training set used as verification data is straightforward, but I am not really clear on how and at what stage of the training should it be incoperated?
Is it at the end of the training (after reaching a good minimum for the training data)? If so, what should be done if the verification data yeilds a big error?
Is it throughout the training (keep looking for a minimum while errors for both the training and verification data aren't satisfactory)?
No matter what I try it seems that the network is having a trouble to learn both training and verification when the verification set reaches a certain size (I recall reading somewhere that 70% training 30% verification is a common ratio, I get stuck at a much smaller one), while it has no problem to learn the same data when used entirely for training.
| 0
| 0
| 0
| 1
| 0
| 0
|
I have the start point (x1,y1) and the desired length and angle of the line.
If the angles were directions, 0 degrees is W, 90 is N, 180 is E and 270 is S. I can modify this if needed.
How can I use the start point, length and angle to determine the end point(x2, y2)?
| 0
| 0
| 0
| 0
| 1
| 0
|
I am doing A/B testing and I am facing Simpson's paradox in my results (day vs month vs total duration of the test).
Does it mean that my a/b testing is not correct/representative? (Some external factor impacted the testing?)
If it is a sign of problem, what are the directions to follow?
Thanks for your great help.
Further reading: http://en.wikipedia.org/wiki/Simpson%27s_paradox
| 0
| 0
| 0
| 0
| 1
| 0
|
I've been meaning to do a little bit of brushing up on my knowledge of statistics. One area where it seems like statistics would be helpful is in profiling code. I say this because it seems like profiling almost always involves me trying to pull some information from a large amount of data.
Are there any subjects in statistics that I could brush up on to get a better understanding of profiler output? Bonus points if you can point me to a book or other resource that will help me understand these subjects better.
| 0
| 0
| 0
| 0
| 1
| 0
|
And now after some work, I finally understand how the KDop bounding volume are created and how the collisions are intersected and I maked a working implementation of them.
Now the problem is another. :D
How can I intersect (it has to be possible, or it would not make any sense) 2 K-Dop of different K values? (obviously we know beforehand which axis has been used to create those 2 K-Dop.)
Like how can i intersect a DOP6 (AABB) and a DOP14 (AABB + corners cut off)?
Or a DOP14 (AABB + corners cut off) and a DOP26 (AABB + Corners cut off + Edges cut off)?
The simple method (between KDOP with the same K) is
public Boolean Intersects(kDOP a, kDOP b)
{
// TODO : How to do if the K is not the same?
for (int i = 0; i < a.K / 2; i++)
if ((a.Min[i] > b.Max[i]) || (a.Max[i] < b.Min[i]))
return false;
return true;
}
Another question is. How to do intersection between KDOP and say a Sphere? KDOP and a Capsule? KDOP and a OOB? KDOP and a AABB? (this should be easier if we know how to do with different K (as AABB is a DOP6 basically))
I mean what's the common way to do intersection between these simple structures?
Thanks a lot for the answers!!!
EDIT : From some search on the net it seems that the separation axis is the way to go, but I can't find any detailed information on how to implement it on the K-DOP. :P
EDIT 2 : Someone has a working implementation of a separation axis theorem over KDOP? :|
| 0
| 0
| 0
| 0
| 1
| 0
|
This question on getting random values from a finite set got me thinking...
It's fairly common for people to want to retrieve X unique values from a set of Y values. For example, I may want to deal a hand from a deck of cards. I want 5 cards, and I want them to all be unique.
Now, I can do this naively, by picking a random card 5 times, and try again each time I get a duplicate, until I get 5 cards. This isn't so great, however, for large numbers of values from large sets. If I wanted 999,999 values from a set of 1,000,000, for instance, this method gets very bad.
The question is: how bad? I'm looking for someone to explain an O() value. Getting the xth number will take y attempts...but how many? I know how to figure this out for any given value, but is there a straightforward way to generalize this for the whole series and get an O() value?
(The question is not: "how can I improve this?" because it's relatively easy to fix, and I'm sure it's been covered many times elsewhere.)
| 0
| 0
| 0
| 0
| 1
| 0
|
I'm writing a tool that is going to be used to process a bunch of 3D data, doing things like rotating objects, translating, scaling and all that good stuff. Does anyone know of a good library that already does some of this common 3D stuff?
I'm not interested in visualizing the data at the moment, and am primarily interested in performing the operations.
Things I know I will need at this point:
2D/3D/4D vectors
(adding, subtracting, dot product, cross product, etc...)
Rotation/Translation/Scaling using matrices
Quaternions
I was able to locate the Sharp3D library, but it seems like it might do what I want but hasn't been updated in a long time. Has anyone used this before? Any other (better) suggestions?
| 0
| 0
| 0
| 0
| 1
| 0
|
I'm looking to submit a patch to the D programming language standard library that will allow much of std.math to be evaluated at compile time using the compile-time function evaluation facilities of the language. Compile-time function evaluation has several limitations, the most important ones being:
You can't use assembly language.
You can't call C code or code for which the source is otherwise unavailable.
Several std.math functions violate these and compile-time versions need to be written. Where can I get information on good algorithms for computing things such as logarithms, exponents, powers, and trig functions? I prefer just high level descriptions of algorithms to actual code, for two reasons:
To avoid legal ambiguity and the need to make my code look "different enough" from the source to make sure I own the copyright.
I want simple, portable algorithms. I don't care about micro-optimization as long as they're at least asymptotically efficient.
Edit: D's compile time function evaluation model allows floating point results computed at compile time to differ from those computed at runtime anyhow, so I don't care if my compile-time algorithms don't give exactly the same result as the runtime version as long as they aren't less accurate to a practically significant extent.
| 0
| 0
| 0
| 0
| 1
| 0
|
What include statement do I need to access the math functions in this C code?
unsigned int fibonacci_closed(unsigned int n) {
double term_number = (double) n;
double golden_ratio = (1 + sqrt(5)) / 2;
double numerator = pow(golden_ratio, term_number);
return round(numerator/sqrt(5));
}
I tried #include <math.h> but that didn't seem to do it.
I'm using Visual Studio 2010 (Windows 7). This is the error:
1>ClCompile:
1> fibonacci_closed.c
1>c:\users\odp\documents\visual studio 2010\projects\fibonacci\fibonacci\fibonacci_closed.c(7): warning C4013: 'round' undefined; assuming extern returning int
1>fibonacci_closed.obj : error LNK2019: unresolved external symbol _round referenced in function _fibonacci_closed
| 0
| 0
| 0
| 0
| 1
| 0
|
I am trying to have flash draw a line from the center of the stage out and increment around the stage. Not sure what math I would use to do this though. So far I have the line going out to a certain point but not sure how to change that point so that it circles around whatever the dimensions of my stage would be.
So far I have this:
var linetox=0;
var linetoy=0;
var _stage=this;
var _stage_center_x = stage.stageWidth/2;
var _stage_center_y = stage.stageHeight/2;
trace(_stage_center_x);
function enterframe(e:Event):void {
linetox+=10;
linetoy+=10;
var lineDrawing:MovieClip = new MovieClip();
this.addChild(lineDrawing);
lineDrawing.graphics.lineStyle(1);
lineDrawing.graphics.moveTo(_stage_center_x,_stage_center_y);///This is where we start drawing
lineDrawing.graphics.lineTo(linetox, linetoy);
}
this.addEventListener(Event.ENTER_FRAME, enterframe);
which obviously moves the destination ending of the line lower and lower, just trying to get it to draw around the screen (like a clock)
| 0
| 0
| 0
| 0
| 1
| 0
|
I'm doing a surface app where I need to scale my scene (zoom) while the user scales with their fingers (i.e pinching)
Currently I have it working ok, but the issue is that I need to zoom in on the center point between the users fingers.
I have the point, but the maths behind the translation is hard to grasp.
When I apply a ScaleTransform to my Canvas scene, it zooms in on the top left of the canvas, i need it to zoom in on the center point of my pinch gesture (which, again, I do have).
How would the maths for the translation work to keep the zoom to appear to zoom in on the center point of the gesture?
Edit:
This is basically what I have:
void Affine2DManipulationDelta(object sender, Affine2DOperationDeltaEventArgs e)
{
//apply zoom and translate
if (e.ScaleDelta != 1)
ApplyZoom(e);
else if (e.Delta.Length != 0)
ApplyTranslation(e);
}
private void ApplyZoom(Affine2DOperationDeltaEventArgs e)
{
//scale
var newScale = _zoomTransform.ScaleX * e.ScaleDelta;
newScale = GetCappedZoomLevel(newScale);
_zoomTransform.ScaleX = newScale;
_zoomTransform.ScaleY = newScale;
}
private void ApplyTranslation(Affine2DOperationDeltaEventArgs e)
{
var xDiff = e.ManipulationOrigin.X - _screenStartPoint.X;
var yDiff = e.ManipulationOrigin.Y - _screenStartPoint.Y;
var translateX = xDiff + _startOffset.X;
var translateY = yDiff + _startOffset.Y;
//bounds testing to limit translation
var rect = new Rect(0.0, 0.0, ZoomCanvas.RenderSize.Width, ZoomCanvas.RenderSize.Height);
Rect bounds = ZoomCanvas.TransformToAncestor(MainViewportCanvas).TransformBounds(rect);
if (CanTranslateX(translateX, bounds))
_translateTransform.X = translateX;
if (CanTranslateY(translateY, bounds))
_translateTransform.Y = translateY;
}
Pretty basic really, but it works to a point...
_zoomTransform is a ScaleTransform, and _translateTransform is a TranslateTransform
MainViewport is a canvas that contains ZoomCanvas which is the canvas that I apply the transforms to.
| 0
| 0
| 0
| 0
| 1
| 0
|
Here is the real world issue that we are solving. We have some rather large data sets that need to be aggregated and summarized in real time with a number of filters and formulas applied to them. It works fine to apply these to each record in real time when the data set is less than 50,000 records but as we approach 100,000 and then 100+ million the overhead of doing realtime math against all of the records gets too great. We have spent a lot of time in SQL doing optimization and then supposing throwing entire datasets in ram and we still come to the conclusion that we need to “zoom out” from the data and summarize groups. We need a way to group like records together and then apply the math to a group of “like records”. This clumping of records allows us to be really fast and doing real time reporting. Our current solution groups record sets that are exactly the same.
Here is an example record
ID77968 1, 43:19.7, 43:19.7, TRUE, 1, 3, 0, 4, 1, 1, 1, 1, 1, 0, 0, 0, 3, 0.1 0, 0, 3, 14, 79,
So if we have 2 of these with exactly the same data
ID77968 1, 43:19.7, 43:19.7, TRUE, 1, 3, 0, 4, 1, 1, 1, 1, 1, 0, 0, 0, 3, 0.1 0, 0, 3, 14, 79,
ID77969 1, 43:19.7, 43:19.7, TRUE, 1, 3, 0, 4, 1, 1, 1, 1, 1, 0, 0, 0, 3, 0.1 0, 0, 3, 14, 79,
then we create a group. Then we can apply the math and logic to a single group and then multiply the outcome by 2 to get the real answer. This works really well for us and can be super helpful in getting around the scale issues of items. That said we now have a new problem. Some of our values have larger ranges of outcomes which is creating datasets of thousands of records with only a couple of them being the exact same. After some brainstorming we came up with an idea of applying some “fuzzy” logic to group things together that are similar. The issue that we have now is that we don’t know the best statistically sound way of going about reducing the record set into groups that aren’t exact the same.
Here is what we need to do. (Simple example, single column)
Suppose we have the following numbers 20 numbers
106
0
8
0
1
0
4
0
3474
0
204
0
75
0
128
0
617
0
20
0
In the above set we have a lot of 0’s so these are easy to group together. But how do I form let’s say 3 more groups. I suppose on the outer bound we have 3474 but given the weighting below that number the outbound group might be something like 2000 and then values 3474 and 617 would be combined to a single group. Our team meeting thought of this as a gravity problem or better known cheerio attraction. Ideally we would find a equation or approach that would let us look at the entire record set and then say..express this in X number of groups. This would allow us to vary the grouping/clumping of the data. So suppose we use the example 20 numbers above and want to express this in 15 groups vs 8 groups we would be able to do this. Now remember that in the example above this is just a single column, but I am trying to group entire records like
ID77968 1, 43:19.7, 43:19.7, TRUE, 1, 3, 0, 4, 1, 1, 1, 1, 1, 0, 0, 0, 3, 0.1 0, 0, 3, 14, 79,
ID77969 1, 43:19.4, 43:19.7, TRUE, 1.2, 3.2, 0, 3, 2, 1, 1, 1, 1, 0, 0, 0, 3, 0.1 0, 0, 3, 14, 179,
Thanks for the help in advance
here is an update based on some of the comments, questions and answers
We currently hash each record as it comes in and then if a record has the same hash, we group it. the issue with hash here is that if it istn exactly the same then, it wont be grouped. This has worked for us for a while becuase our values in each column as relatively bounded. We now have introduced some values that have far greater ranges which has rendered our hash grouping ineffective. Before we were able to take 100mm records and hash them to ajust over 100k groups but now we are seeing neew data in sets that are just 70k with all 70k being unique. Deidentified data here: Copy of rv.zip (3,58 MB)
| 0
| 0
| 0
| 0
| 1
| 0
|
I have an array of numbers from 5 to 6.4 but the numbers are relating to feet and inches and I am using them for calculation.
When I come to use 5.10 it removes the zero and I have the same output as though it was 5.1.
Is there anyway to prevent PHP removing the 0. I presume it does some sort of default casting.
Thanks in advance
| 0
| 0
| 0
| 0
| 1
| 0
|
And here we are for another question.
After the previous one, i finally completed the kDop system and everything related. (Hierarchycal tree of kDop, etc..)
Everything works fine.
Now i want to draw on screen the collision for debug purpose and to see the result of the work. (To see if the hierarchical choice i've done in a particular mode is fine or not)
For the AABB/Sphere no problem, its pretty much easy to create.
The problem is with the kDOP...
I have :
axises
(1,0,0)(0,1,0)(0,0,1)(1,1,1)(-1,1,1)(1,-1,1)(1,1,-1)(1,1,0)(1,0,1),(0,1,1),(1,-1,0),(1,0,-1),(0,1,-1)
and the Min/Max values calculated using the axes.
How can i create a series of polygon (a simple mesh in fact) with these data?
(I don't care about implementation, i just want to understand it theorically so I can implement it)
Thanks a lot for the answers!!!
EDIT : I can calculate EASILY the normals of the mesh cause I already have the axis. The problem is calculating the vertex position...
EDIT 2: I found on the net this code that seems to be useful (or at least in the doc it says its for creating a debug mesh), but I don't know how to use it to find the vertex position :
real Kdop::getDistanceOfPlaneToOrigin(int k) const {
if (k < 0 || k >= mK) {
return 0.0f;
}
if (k >= mK/2) {
return (real) (mDistances[k] * -1.0);
}
return mDistances[k];
}
EDIT 3: I thought and having normals and a point (the origin, that i'm sure the plane pass over), i can build all the planes related to the operation... Now I need something more....
| 0
| 0
| 0
| 0
| 1
| 0
|
After I have seen a lot of questions here using the DATE_SUB() or DATE_ADD() functions instead of the arithmetic operators + or -, I was wondering if there was any difference:
Quote from the MySQL-manual:
Date arithmetic also can be performed using INTERVAL together with the + or
- operator:
date + INTERVAL expr unit
date - INTERVAL expr unit
So basically, these two statements return the same result:
SELECT DATE_ADD(NOW(), INTERVAL 7 DAY);
and
SELECT NOW() + INTERVAL 7 DAY;
Now my question:
Is there any difference between DATE_SUB() and using the - operator in MySQL? (besides readability?)
| 0
| 0
| 0
| 0
| 1
| 0
|
When designing a feed forward neural network with multiple outputs, is there a conceptual difference (other than computational efficency) between having a single network with multiple outputs, and having multiple networks, each having a single output?
Although output neurons in the same network don't affect each other "on the fly", they do affect training, since the error from each output backpropagates and affects the weights of the hidden layer, which in turn affect the value of the other outputs.
Are there problems that are better solved either way? Intuitively, I'd say that a single network better fits problems where only one output should be active at a time (i.e OCR), where multiple networks better fit problems where multiple outputs can be active simultanously (i.e. when each output correspond to some characteristic in the input, where several of them can be present simultaniously). But this is mere intuition. Does it practically hold?
| 0
| 0
| 0
| 1
| 0
| 0
|
I'm using a python library called Guess Language: http://pypi.python.org/pypi/guess-language/0.1
"justwords" is a string with unicode text. I stick it in the package, but it always returns English, even though the web page is in Japanese. Does anyone know why? Am I not encoding correctly?
§ç©ºéå
¶ä»æ¡å°±æ²æéç¨®å¾ é¤ï¼æä»¥ä¾é裡ç¶ç
éäºï¼åæ¤ç°å¢æ°£æ°¹³åèµ·ä¾åªè½ç®âå¾å¥½âé常好âåå ¶æ¯è¦é»é¤ï¼é¨ä¾¿é»çé»ã飲æãä¸ææ²»çåä¸å 便å®ï¼æ¯æ´è¥ç äºï¼æ³æ³é裡以å°é»ãæ¯è§ä¾èªªä¹è©²æpremiumï¼åªæ±é¤é»å¥½å就好äºã<br /><br />é¦åç¾ï¼æä»¥å°±é»å宿´ç æ£è¦åä¸ä¸å
ä¸ç å¥é¤å§ï¼å
justwords = justwords.encode('utf-8')
true_lang = str(guess_language.guessLanguage(justwords))
print true_lang
Edit: THanks guys for your help. This is an update of the problem.
I am trying to "guess" the language of this: http://feeds.feedburner.com/nchild
Basically, in Python, I get the htmlSource. Then, I strip the tags using BeautifulSoup. Then, I pass it to the library to get the language. If I do not do encode('utf-8'), then ASCII-errors will come up. So , this is a must.
soup = BeautifulStoneSoup(htmlSource)
justwords = ''.join(soup.findAll(text=True))
justwords = justwords.encode('utf-8')
true_lang = str(guess_language.guessLanguage(justwords))
| 0
| 1
| 0
| 0
| 0
| 0
|
I'm building a video player and am kinda stuck at the volume slider part. It's a YouTube style vertical slider, meaning if the slider is in the top position volume should be 100% and if the slider is dragged to the bottom position sound should be 0. Currently it's doing the opposite of what I want :(
Dragging the slider down will make the sound louder, while dragging up lowers it.
Here is my code below dealing with the volume slider.
// Sound Controller Settings ······························
soundController = new SoundController();
soundContrColor = soundController.colorChip;
soundContrGray = soundController.grayCover;
soundContrGray.visible = false;
soundController.visible = true;
soundController.buttonMode = true;
soundController.soundSlider.addEventListener(MouseEvent.MOUSE_DOWN, sliderDown);
// SoundController Button Mouse Events ························
public function sliderDown(event:MouseEvent):void
{
soundController.soundSlider.startDrag(false, dragBounds);
soundController.soundSlider.addEventListener(MouseEvent.MOUSE_MOVE, sliderMove);
soundController.soundSlider.addEventListener(MouseEvent.MOUSE_UP, sliderUp);
soundContrGray.visible = true;
}
public function sliderMove(event:MouseEvent):void
{
soundContrGray.height = soundController.soundSlider.y;
userVolume = Math.round(((soundContrGray.y * soundContrGray.height) / 10) - 4);
//userVolume = soundContrGray.height;
setVolume(userVolume);
trace("soundController.mouseY = "+soundController.soundSlider.y);
trace("soundContrColor.height = "+Math.round(soundContrGray.height));
trace("userVolume = "+userVolume+"\r");
event.updateAfterEvent();
}
public function sliderUp(event:MouseEvent):void
{
lastVolPoint = soundContrGray.height;
setVolume(userVolume);
event.updateAfterEvent();
soundController.soundSlider.stopDrag();
soundController.soundSlider.removeEventListener(MouseEvent.MOUSE_MOVE, sliderMove);
soundController.soundSlider.removeEventListener(MouseEvent.MOUSE_UP, sliderUp);
}
[TRACES] when I drag all the way to the top:
soundController.mouseY = 6
soundContrGray.height = 6
userVolume = 0
[TRACES] when I drag all the way down:
soundController.mouseY = 56
soundContrGray.height = 56
userVolume = 30
I believe this is where the problem lies:
userVolume = Math.round(((soundContrGray.y * soundContrGray.height) / 10) - 4);
The (-4) is an offset value so when you drag it all the way to turn it off, it's 0 and not 4.
I need to reverse this somehow, so the traces above will swap... going down will make userVolume = 4 and going up will make it 30.
Thanks in advance for anyone that takes a look at this one! :)
| 0
| 0
| 0
| 0
| 1
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.