Search Results

Search found 3425 results on 137 pages for 'polynomial math'.

Page 46/137 | < Previous Page | 42 43 44 45 46 47 48 49 50 51 52 53  | Next Page >

  • Distributing players to tables

    - by IVlad
    Consider N = 4k players, k tables and a number of clans such that each member can belong to one clan. A clan can contain at most k players. We want to organize 3 rounds of a game such that, for each table that seats exactly 4 players, no 2 players sitting there are part of the same clan, and, for the later rounds, no 2 players sitting there have sat at the same table before. All players play all rounds. How can we do this efficiently if N can be about ~80 large? I thought of this: for each table T: repeat until 4 players have been seated at T: pick a random player X that is not currently seated anywhere if X has not sat at the same table as anyone currently at T AND X is not from the same clan as anyone currently at T seat X at T break I am not sure if this will always finish or if it can get stuck even if there is a valid assignment. Even if this works, is there a better way to do it?

    Read the article

  • Millionth number in the serie 2 3 4 6 9 13 19 28 42 63 ... ?

    - by HH
    It takes about minute to achieve 3000 in my comp but I need to know the millionth number in the serie. The definition is recursive so I cannot see any shortcuts except to calculate everything before the millionth number. How can you fast calculate millionth number in the serie? Serie Def n_{i+1} = \floor{ 3/2 * n_{i} } and n_{0}=2. Interestingly, only one site list the serie according to Goolge: this one. Too slow Bash code #!/bin/bash function serie { n=$( echo "3/2*$n" | bc -l | tr '\n' ' ' | sed -e 's@\\@@g' -e 's@ @@g' ); # bc gives \ at very large numbers, sed-tr for it n=$( echo $n/1 | bc ) #DUMMY FLOOR func } n=2 nth=1 while [ true ]; #$nth -lt 500 ]; do serie $n # n gets new value in the function throught global value echo $nth $n nth=$( echo $nth + 1 | bc ) #n++ done

    Read the article

  • Getting confused why i dont get expected amount ?

    - by Stackfan
    I have 1 result and which i will receive in Bank account, Based on that account i have to Put a balance to user account. How can you find the Handling cost from total tried 491.50 / 0.95 = 517.36 which is wrong ? It should be 500.00 (to my expectation) User balance requires 500.00 When 500.00 selected he gets 5% discount There is a handling cost for this ex: 1) Discount: 500.00 - 5% = 475.00 2) Handling cost: (475.00 x 0.034) + 0.35 = 16.50 3) Total: 475.00 + 16.50 = 491.50 So problem is from 491.50, i have to find atleast handling cost to get promised Balance. Any solution ? Cant figure it out myself...

    Read the article

  • Is there a transformation matrix that can scale the x and/or y axis logarithmically?

    - by Dave M
    I'm using .net WPF geometry classes to graph waveforms. I've been using the matrix transformations to convert from the screen coordinate space to my coordinate space for the waveform. Everything works great and it's really simple to keep track of my window and scaling, etc. I can even use the inverse transform to calculate the mouse position in terms of the coordinate space. I use the built in Scaling and Translation classes and then a custom matrix to do the y-axis flipping (there's not a prefab matrix for flipping). I want to be able to graph these waveforms on a log scale as well (either x axis or y axis or both), but I'm not sure if this is even possible to do with a matrix transformation. Does anyone know if this is possible, and if it is, what is the matrix?

    Read the article

  • How do I get points on a curve in PHP with log()?

    - by Erick
    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>\n"; } 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!!

    Read the article

  • Javascript returns Nan in IE, FF ok

    - by user350184
    im very new to javascript, and writing this script to add up a shopping cart and print out subtotals and totals. it works in FF but not in IE. this function is called by onclick of one of three select options with a value of 0-25. it is in a js file called in the head. what it does is get the selected values as variables, parseint them, adds and multiplies, and changes the innerHTML of the table to reflect the subtotals, and total. FF does it great, but IE gives Nan. ive tried rewriting it a number of different ways, and many translations still work in FF but not IE8. ive made sure the variables and form id's arent repeated. function gen_invoice() { var scount = parseInt(document.shopcart.studentcount.value, 10); var ycount = parseInt(document.shopcart.youthcount.value, 10); var fcount = parseInt(document.shopcart.facultycount.value, 10); //html output source is 3 selects like this, with diff ids and names: //<select name="studentcount" id="studentcount"> //<option onclick="gen_invoice()" value="0">0 </option></select> var cardcost = parseInt(document.shopcart.cardprice.value, 10); //cardcost comes from hidden input value: //<input type="hidden" id="cardprice" name="cardprice" value="25"> var totalsum = scount + ycount + fcount; var grandtotal = totalsum * cardcost; document.getElementById('s_price').innerHTML = scount * cardcost; document.getElementById('y_price').innerHTML = ycount * cardcost; document.getElementById('f_price').innerHTML = fcount * cardcost; document.getElementById('grand').innerHTML = grandtotal; //.... } ...after this there are 3 long loops for writing out some other forms, but they dont work in IE either because they depend on the selected values to be an integer. this part happens first and returns Nan, so im sure the problem is here somwhere. I have literally hit my head on the table over this. You can imagine how frustrating it is to be able to write the entire rest of the site beautifully, but then fail at adding 3 numbers together. help please!

    Read the article

  • Intersection of line and rectangle with maximum segment length

    - by Aarkan
    I have a vector represented by the slope m. Then there is rectangle (assume axis aligned), which is represented by top-left and bottom-right corner. Of course, there may be many lines with slope m and intersecting the given rectangle. The problem is to find out the line whose length of line intercept inside the rectangle is maximum among all such lines. i.e., if the line intersects rectangle at P1 and P2, then the problem is to find the equation of line for which length of P1P2 is maximum. I proceeded like this. Let the line is: y = m*x + c. Then find out the intersection with each side of rectangle and finding out the maxima for distance function between each pair of points. But it will only give me the length of line segment and there seem to be many corner cases to handle. Could anyone please suggest a better way to do this. Thanks in advance.

    Read the article

  • A Plot Graph .NET WindowsForm Component Free

    - by user255946
    Hello All, I'm searching for a plot .NET component to plot a 2D line chart, given an array of data. It will be used with WindowsForm (C#) and It will be very helpful if it could be freeware. It is for a scientific application. This is my first asked question in stackoverflow, and excuse me for my terrible English written.

    Read the article

  • 3D points to quaternions

    - by Hubrus
    For the simplicity, we'll consider two 3D points, that moves one relatively to other, in time. Let's say: at moment t0, we have P1(0,0,0) and P2(0,2,0) at moment t1, P1 is still (0,0,0) but P2 changed to (0,2,2). From what I've understood reading about quaternions, is that, at moment t0, Q1 (representing P1) and Q2 (representing P2) will be both (0, 0, 0, 0). But at the moment t1, Q2 will become something else (w, x, y, z). How do I calculate the Q2 at t1 moment? I've googled a lot on this subject, but I was able to find only rotation between quaternions. I will appreciate any guidance. Thanks!

    Read the article

  • Figuring out QuadCurveTo's parameters

    - by Fev
    Could you guys help me figuring out QuadCurveTo's 4 parameters , I tried to find information on http://docs.oracle.com/javafx/2/api/javafx/scene/shape/QuadCurveTo.html, but it's hard for me to understand without picture , I search on google about 'Quadratic Bezier' but it shows me more than 2 coordinates, I'm confused and blind now. I know those 4 parameters draw 2 lines to control the path , but how we know/count exactly which coordinates the object will throught by only knowing those 2 path-controller. Are there some formulas? import javafx.animation.PathTransition; import javafx.animation.PathTransition.OrientationType; import javafx.application.Application; import static javafx.application.Application.launch; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.paint.Color; import javafx.scene.shape.MoveTo; import javafx.scene.shape.Path; import javafx.scene.shape.QuadCurveTo; import javafx.scene.shape.Rectangle; import javafx.stage.Stage; import javafx.util.Duration; public class _6 extends Application { public Rectangle r; @Override public void start(final Stage stage) { r = new Rectangle(50, 80, 80, 90); r.setFill(javafx.scene.paint.Color.ORANGE); r.setStrokeWidth(5); r.setStroke(Color.ANTIQUEWHITE); Path path = new Path(); path.getElements().add(new MoveTo(100.0f, 400.0f)); path.getElements().add(new QuadCurveTo(150.0f, 60.0f, 100.0f, 20.0f)); PathTransition pt = new PathTransition(Duration.millis(1000), path); pt.setDuration(Duration.millis(10000)); pt.setNode(r); pt.setPath(path); pt.setOrientation(OrientationType.ORTHOGONAL_TO_TANGENT); pt.setCycleCount(4000); pt.setAutoReverse(true); pt.play(); stage.setScene(new Scene(new Group(r), 500, 700)); stage.show(); } public static void main(String[] args) { launch(args); } } You can find those coordinates on this new QuadCurveTo(150.0f, 60.0f, 100.0f, 20.0f) line, and below is the picture of Quadratic Bezier

    Read the article

  • Can a real number "cover" all integers within its range?

    - by macias
    Is there a guarantee that a real number (float, double, etc) can "cover" all integers within its range? By cover I mean, that for every integer within its range there is such real number that this equality holds: real == int Or in another example, let's say I have the biggest real number which is smaller than given integer. When I add "epsilon" will I get this number equal to given integer or bigger than integer? (I know that among real numbers you should not write comparisons as == for equality, I am simply asking for better understanding subject, not for coding comparisons.)

    Read the article

  • Double # showing 0 on android

    - by Dave
    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 =/.

    Read the article

  • Histrogram matching - image processing - c/c++

    - by Raj
    Hello I have two histograms. int Hist1[10] = {1,4,3,5,2,5,4,6,3,2}; int Hist1[10] = {1,4,3,15,12,15,4,6,3,2}; Hist1's distribution is of type multi-modal; Hist2's distribution is of type uni-modal with single prominent peak. My questions are Is there any way that i could determine the type of distribution programmatically? How to quantify whether these two histograms are similar/dissimilar? Thanks

    Read the article

  • java random percentages

    - by erw
    I need to generate n percentages (integers between 0 and 100) such that the sum of all n numbers adds up to 100. If I just do nextInt() n times, each time ensuring that the parameter is 100 minus the previously accumulated sum, then my percentages are biased (i.e. the first generated number will usually be largest etc.). How do I do this in an unbiased way?

    Read the article

  • Shortest distance between points on a toroidally wrapped (x- and y- wrapping) map?

    - by mstksg
    I have a toroidal-ish Euclidean-ish map. That is the surface is a flat, Euclidean rectangle, but when a point moves to the right boundary, it will appear at the left boundary (at the same y value), given by x_new = x_old % width Basically, points are plotted based on: (x_new, y_new) = ( x_old % width, y_old % height) Think Pac Man -- walking off one edge of the screen will make you appear on the opposite edge. What's the best way to calculate the shortest distance between two points? The typical implementation suggests a large distance for points on opposite corners of the map, when in reality, the real wrapped distance is very close. The best way I can think of is calculating Classical Delta X and Wrapped Delta X, and Classical Delta Y and Wrapped Delta Y, and using the lower of each pair in the Sqrt(x^2+y^2) distance formula. But that would involve many checks, calculations, operations -- some that I feel might be unnecessary. Is there a better way?

    Read the article

  • License key pattern detection?

    - by Ricket
    This is not a real situation; please ignore legal issues that you might think apply, because they don't. Let's say I have a set of 200 known valid license keys for a hypothetical piece of software's licensing algorithm, and a license key consists of 5 sets of 5 alphanumeric case-insensitive (all uppercase) characters. Example: HXDY6-R3DD7-Y8FRT-UNPVT-JSKON Is it possible (or likely) to extrapolate other possible keys for the system? What if the set was known to be consecutive; how do the methods change for this situation, and what kind of advantage does this give? I have heard of "keygens" before, but I believe they are probably made by decompiling the licensing software rather than examining known valid keys. In this case, I am only given the set of keys and I must determine the algorithm. I'm also told it is an industry standard algorithm, so it's probably not something basic, though the chance is always there I suppose. If you think this doesn't belong in Stack Overflow, please at least suggest an alternate place for me to look or ask the question. I honestly don't know where to begin with a problem like this. I don't even know the terminology for this kind of problem.

    Read the article

  • Basic C++ code for multiplication of 2 matrix or vectors (C++ beginner)

    - by Ice
    I am a new C++ user and I am also doing a major in Maths so thought I would try implement a simple calculator. I got some code off the internet and now I just need help to multiply elements of 2 matrices or vectors. Matrixf multiply(Matrixf const& left, Matrixf const& right) { // error check if (left.ncols() != right.nrows()) { throw std::runtime_error("Unable to multiply: matrix dimensions not agree."); } /* I have all the other part of the code for matrix*/ /** Now I am not sure how to implement multiplication of vector or matrix.**/ Matrixf ret(1, 1); return ret; }

    Read the article

  • Dilemma with two types and operator +

    - by user35443
    I have small problem with operators. I have this code: public class A { public string Name { get; set; } public A() { } public A(string Name) { this.Name = Name; } public static implicit operator B(A a) { return new B(a.Name); } public static A operator+(A a, A b) { return new A(a.Name + " " + b.Name); } } public class B { public string Name { get; set; } public B() { } public B(string Name) { this.Name = Name; } public static implicit operator A(B b) { return new A(b.Name); } public static B operator +(B b, B a) { return new B(b.Name + " " + a.Name); } } Now I want to know, which's conversion operator will be called and which's addition operator will be called in this operation: new A("a") + new B("b"); Will it be operator of A, or of B? (Or both?) Thanks....

    Read the article

  • Function to convert a z-score into a percentage

    - by Daniel
    Google doesn't want to help! I'm able to calculate z-scores, and we are trying to produce a function that given a z-score gives us a percent of the population in a normal distribution that would be under that z-score. All I can find are references to z-score to percentage tables. Any pointers?

    Read the article

< Previous Page | 42 43 44 45 46 47 48 49 50 51 52 53  | Next Page >