Search Results

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

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

  • Wpf. Chart optimization. More than million points

    - by Evgeny
    I have custom control - chart with size, for example, 300x300 pixels and more than one million points (maybe less) in it. And its clear that now he works very slowly. I am searching for algoritm which will show only few points with minimal visual difference. I have link to component which have functionallity exactly what i need (2 million points demo): http://www.mindscape.co.nz/demo/SilverlightElements/demopage.html#/ChartOverviewPage I will be grateful for any matherials, links or thoughts how to realize such functionallity.

    Read the article

  • division problems

    - by David
    This line of code: System.out.println ("aray[j], "+aray[j]+", divided by sum, "+sum+", equals: aray[j]/sum: "+ aray[j]/sum) ; is yeilding this line of text: aray[j], 21, divided by sum, 100, equals: aray[j]/sum: 0 why is it doing this? (everything is right eccept that the answer should be .21)

    Read the article

  • Fastest method to define whether a number is a triangular number

    - by psihodelia
    A triangular number is the sum of the n natural numbers from 1 to n. What is the fastest method to find whether a given positive integer number is a triangular one? I suppose, there must be a hidden pattern in a binary representation of such numbers (like if you need to find whether a number is even/odd you check its least significant bit). Here is a cut of the first 1200th up to 1300th triangular numbers, you can easily see a bit-pattern here (if not, try to zoom out): (720600, '10101111111011011000') (721801, '10110000001110001001') (723003, '10110000100000111011') (724206, '10110000110011101110') (725410, '10110001000110100010') (726615, '10110001011001010111') (727821, '10110001101100001101') (729028, '10110001111111000100') (730236, '10110010010001111100') (731445, '10110010100100110101') (732655, '10110010110111101111') (733866, '10110011001010101010') (735078, '10110011011101100110') (736291, '10110011110000100011') (737505, '10110100000011100001') (738720, '10110100010110100000') (739936, '10110100101001100000') (741153, '10110100111100100001') (742371, '10110101001111100011') (743590, '10110101100010100110') (744810, '10110101110101101010') (746031, '10110110001000101111') (747253, '10110110011011110101') (748476, '10110110101110111100') (749700, '10110111000010000100') (750925, '10110111010101001101') (752151, '10110111101000010111') (753378, '10110111111011100010') (754606, '10111000001110101110') (755835, '10111000100001111011') (757065, '10111000110101001001') (758296, '10111001001000011000') (759528, '10111001011011101000') (760761, '10111001101110111001') (761995, '10111010000010001011') (763230, '10111010010101011110') (764466, '10111010101000110010') (765703, '10111010111100000111') (766941, '10111011001111011101') (768180, '10111011100010110100') (769420, '10111011110110001100') (770661, '10111100001001100101') (771903, '10111100011100111111') (773146, '10111100110000011010') (774390, '10111101000011110110') (775635, '10111101010111010011') (776881, '10111101101010110001') (778128, '10111101111110010000') (779376, '10111110010001110000') (780625, '10111110100101010001') (781875, '10111110111000110011') (783126, '10111111001100010110') (784378, '10111111011111111010') (785631, '10111111110011011111') (786885, '11000000000111000101') (788140, '11000000011010101100') (789396, '11000000101110010100') (790653, '11000001000001111101') (791911, '11000001010101100111') (793170, '11000001101001010010') (794430, '11000001111100111110') (795691, '11000010010000101011') (796953, '11000010100100011001') (798216, '11000010111000001000') (799480, '11000011001011111000') (800745, '11000011011111101001') (802011, '11000011110011011011') (803278, '11000100000111001110') (804546, '11000100011011000010') (805815, '11000100101110110111') (807085, '11000101000010101101') (808356, '11000101010110100100') (809628, '11000101101010011100') (810901, '11000101111110010101') (812175, '11000110010010001111') (813450, '11000110100110001010') (814726, '11000110111010000110') (816003, '11000111001110000011') (817281, '11000111100010000001') (818560, '11000111110110000000') (819840, '11001000001010000000') (821121, '11001000011110000001') (822403, '11001000110010000011') (823686, '11001001000110000110') (824970, '11001001011010001010') (826255, '11001001101110001111') (827541, '11001010000010010101') (828828, '11001010010110011100') (830116, '11001010101010100100') (831405, '11001010111110101101') (832695, '11001011010010110111') (833986, '11001011100111000010') (835278, '11001011111011001110') (836571, '11001100001111011011') (837865, '11001100100011101001') (839160, '11001100110111111000') (840456, '11001101001100001000') (841753, '11001101100000011001') (843051, '11001101110100101011') (844350, '11001110001000111110') For example, can you also see a rotated normal distribution curve, represented by zeros between 807085 and 831405?

    Read the article

  • need help with some basic java.

    - by Racket
    Hi, I'm doing the first chapter exercises on my Java book and I have been stuck for a problem for a while now. I'll print the question, prompt/read a double value representing a monetary amount. Then determine the fewest number of each bill and coin needed to represent that amount, starting with the highest (assume that a ten dollar bill is the maximum size needed). For example, if the value entered is 47,63 (forty-seven dollars and sixty-three cents), and the program should print the equivalent amount as: 4 ten dollar bills 1 five dollar bills 2 one dollar bills 2 quarters 1 dimes 0 nickels 3 pennies" etc. I'm doing an example exactly as they said in order to get an idea, as you will see in the code. Nevertheless, I managed to print 4 dollars, and I can't figure out how to get "1 five dollar", only 7 dollars (see code). Please, don't do the whole code for me. I just need some advice in regards to what I said. Thank you. import java.util.Scanner; public class PP29 { public static void main (String[] args) { Scanner sc = new Scanner (System.in); int amount; double value; double test1; double quarter; System.out.println("Enter \"double\" value: "); value = sc.nextDouble(); amount = (int) value / 10; // 47,63 / 10 = 4. int amount2 = (int) value % 10; // 47 - 40 = 7 quarter = value * 100; // 47,63 * 100 = 4736 int sum = (int) quarter % 100; // 4763 / 100 => 4763-4700 = 63. System.out.println(amount); System.out.println(amount2); } }

    Read the article

  • Is there an easily available implementation of erf() for Python?

    - by rog
    I can implement the error function, erf, myself, but I'd prefer not to. Is there a python package with no external dependencies that contains an implementation of this function? I have found http://pylab.sourceforge.net/packages/included_functions.htmlthis but this seems to be part of some much larger package (and it's not even clear which one!). I'm sorry if this is a naive question - I'm totally new to Python.

    Read the article

  • Mysterious combination

    - by pstone
    I decided to learn concurrency and wanted to find out in how many ways instructions from two different processes could overlap. The code for both processes is just a 10 iteration loop with 3 instructions performed in each iteration. I figured out the problem consisted of leaving X instructions fixed at a point and then fit the other X instructions from the other process between the spaces taking into account that they must be ordered (instruction 4 of process B must always come before instruction 20). I wrote a program to count this number, looking at the results I found out that the solution is n Combination k, where k is the number of instructions executed throughout the whole loop of one process, so for 10 iterations it would be 30, and n is k*2 (2 processes). In other words, n number of objects with n/2 fixed and having to fit n/2 among the spaces without the latter n/2 losing their order. Ok problem solved. No, not really. I have no idea why this is, I understand that the definition of a combination is, in how many ways can you take k elements from a group of n such that all the groups are different but the order in which you take the elements doesn't matter. In this case we have n elements and we are actually taking them all, because all the instructions are executed ( n C n). If one explains it by saying that there are 2k blue (A) and red (B) objects in a bag and you take k objects from the bag, you are still only taking k instructions when 2k instructions are actually executed. Can you please shed some light into this? Thanks in advance.

    Read the article

  • Replace for loop with formula

    - by hamax
    I have this loop that runs in O(end - start) and I would like to replace it with something O(1). If "width" wouldn't be decreasing, it would be pretty simple. for (int i = start; i <= end; i++, width--) if (i % 3 > 0) // 1 or 2, but not 0 z += width; start, end and width have positive values

    Read the article

  • Scaling range of values with negative numbers

    - by Pradeep Kumar
    How can I scale a set of values to fit a new range if they include negative numbers? For example, I have a set of numbers (-10, -9, 1, 4, 10) which have to scaled to a range [0 1], such that -10 maps to 0, and 10 maps to 1. The regular method for an arbitrary number 'x' would be: (x - from_min) * (to_max - to_min) / (from_max - from_min) + to_min but this does not work for negative numbers. Any help is appreciated. Thanks!!

    Read the article

  • How to calculate the state of a graph?

    - by zcb
    Given a graph G=(V,E), each node i is associated with 'Ci' number of objects. At each step, for every node i, the Ci objects will be taken away by the neighbors of i equally. After K steps, output the number of objects of the top five nodes which has the most objects. Some Constrains: |V|<10^5, |E|<2*10^5, K<10^7, Ci<1000 My current idea is: represent the transformation in each step with a matrix. This problem is converted to the calculation of the power of matrix. But this solution is much too slow considering |V| can be 10^5. Is there any faster way to do it?

    Read the article

  • Recursively determine average value

    - by theva
    I have to calculate an average value of my simulation. The simulation is ongoing and I want (for each iteration) to print the current average value. How do I do that? I tried the code below (in the loop), but I do not think that the right value is calculated... int average = 0; int newValue; // Continuously updated value. if(average == 0) { average = newValue; } average = (average + newValue)/2; I also taught about store each newValue in an array and for each iteration summarize the whole array and do the calculation. However, I don't think that's a good solution, because the loop is an infinity loop so I can't really determine the size of the array. There is also a possibility that I am thinking too much and that the code above is actually correct, but I don't think so...

    Read the article

  • Populate array from vector

    - by Zag zag..
    Hi, I would like to populate an 2 dimensional array, from a vector. I think the best way to explain myself is to put some examples (with a array of [3,5] length). When vector is: [1, 0] [ [4, 3, 2, 1, 0], [4, 3, 2, 1, 0], [4, 3, 2, 1, 0] ] When vector is: [-1, 0] [ [0, 1, 2, 3, 4], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4] ] When vector is: [-2, 0] [ [0, 0, 1, 1, 2], [0, 0, 1, 1, 2], [0, 0, 1, 1, 2] ] When vector is: [1, 1] [ [2, 2, 2, 1, 0], [1, 1, 1, 1, 0], [0, 0, 0, 0, 0] ] When vector is: [0, 1] [ [2, 2, 2, 2, 2], [1, 1, 1, 1, 1], [0, 0, 0, 0, 0] ] Have you got any ideas, a good library or a plan? Any comments are welcome. Thanks. Note: I consulted Ruby "Matrix" and "Vector" classes, but I don't see any way to use it in my way... Edit: In fact, each value is the number of cells (from the current cell to the last cell) according to the given vector. If we take the example where the vector is [-2, 0], with the value *1* (at array[2, 3]): array = [ [<0>, <0>, <1>, <1>, <2>], [<0>, <0>, <1>, <1>, <2>], [<0>, <0>, <1>, *1*, <2>] ] ... we could think such as: The vector [-2, 0] means that -2 is for cols and 0 is for rows. So if we are in array[2, 3], we can move 1 time on the left (left because 2 is negative) with 2 length (because -2.abs == 2). And we don't move on the top or bottom, because of 0 for rows.

    Read the article

  • Solve Physics exercise by brute force approach..

    - by Nils
    Being unable to reproduce a given result. (either because it's wrong or because I was doing something wrong) I was asking myself if it would be easy to just write a small program which takes all the constants and given number and permutes it with a possible operators (* / - + exp(..)) etc) until the result is found. Permutations of n distinct objects with repetition allowed is n^r. At least as long as r is small I think you should be able to do this. I wonder if anybody did something similar here..

    Read the article

  • Special simple random number generator

    - by psihodelia
    How to create a function, which on every call generates a random integer number? This number must be most random as possible (according to uniform distribution). It is only allowed to use one static variable and at most 3 elementary steps, where each step consists of only one basic arithmetic operation of arity 1 or 2. Example: int myrandom(void){ static int x; x = some_step1; x = some_step2; x = some_step3; return x; } Basic arithmetic operations are +,-,%,and, not, xor, or, left shift, right shift, multiplication and division. Of course, no rand(), random() or similar staff is allowed.

    Read the article

  • log (1-var) operation in C

    - by heike
    I am trying to code this algorithm. I am stuck in the part of log((1.0-u)/u))/beta; As I understand, I can not get the result of this in C, as it will always return me with negative value log (returning imaginary value). Tried to print the result of log(1-5) for instance, it gives me with Nan. How can I get the result of double x = (alpha - log((1.0-u)/u))/beta then? Would appreciate for any pointers to solve this problem. Thank you

    Read the article

  • Number of 0/1 colorings of a m X n rectangle which have no monochromatic subrectangles with both dimension greater than 1.

    - by acbruptenda
    A m x n rectangular matrix is give, and each cell is to be filled with 0/1 colour. I have to find number of colorings possible so that there is no monochromatic coloured (same colour) sub-rectangle whose both dimension is greater than 1 (eg - 2x2, 2x3,4x3) I have found a slightly different version of it here But they have said nothing about the algorithm. So, I am looking for an algorithm here !!

    Read the article

  • Permutations with extra restrictions

    - by Full Decent
    I have a set of items, for example: {1,1,1,2,2,3,3,3}, and a restricting set of sets, for example {{3},{1,2},{1,2,3},{1,2,3},{1,2,3},{1,2,3},{2,3},{2,3}. I am looking for permutations of items, but the first element must be 3, and the second must be 1 or 2, etc. One such permutation that fits is: {3,1,1,1,2,2,3} Is there an algorithm to count all permutations for this problem in general? Is there a name for this type of problem? For illustration, I know how to solve this problem for certain types of "restricting sets". Set of items: {1,1,2,2,3}, Restrictions {{1,2},{1,2,3},{1,2,3},{1,2},{1,2}}. This is equal to 2!/(2-1)!/1! * 4!/2!/2!. Effectively permuting the 3 first, since it is the most restrictive and then permuting the remaining items where there is room.

    Read the article

  • Write number N in base M

    - by VaioIsBorn
    I know how to do it mathematically, but i want it now to do it in c++ using some easy algorithm. Is is possible? The question is that i need some methods/ideas for writing a number N in base M, for example 1410 in base 3: (14)10 = 2*(3^0) + 1*(3^1) + 1*(3^2) = (112)3 etc.

    Read the article

  • Given a vector of maximum 10 000 natural and distinct numbers, find 4 numbers(a, b, c, d) such that

    - by king_kong
    Hi, I solved this problem by following a straightforward but not optimal algorithm. I sorted the vector in descending order and after that substracted numbers from max to min to see if I get a + b + c = d. Notice that I haven't used anywhere the fact that elements are natural, distinct and 10 000 at most. I suppose these details are the key. Does anyone here have a hint over an optimal way of solving this? Thank you in advance! Later Edit: My idea goes like this: '<<quicksort in descending order>>' for i:=0 to count { // after sorting, loop through the array int d := v[i]; for j:=i+1 to count { int dif1 := d - v[j]; int a := v[j]; for k:=j+1 to count { if (v[k] > dif1) continue; int dif2 := dif1 - v[k]; b := v[k]; for l:=k+1 to count { if (dif2 = v[l]) { c := dif2; return {a, b, c, d} } } } } } What do you think?(sorry for the bad indentation)

    Read the article

  • Minimizing distance to a weighted grid

    - by Andrew Tomazos - Fathomling
    Lets suppose you have a 1000x1000 grid of positive integer weights W. We want to find the cell that minimizes the average weighted distance.to each cell. The brute force way to do this would be to loop over each candidate cell and calculate the distance: int best_x, best_y, best_dist; for x0 = 1:1000, for y0 = 1:1000, int total_dist = 0; for x1 = 1:1000, for y1 = 1:1000, total_dist += W[x1,y1] * sqrt((x0-x1)^2 + (y0-y1)^2); if (total_dist < best_dist) best_x = x0; best_y = y0; best_dist = total_dist; This takes ~10^12 operations, which is too long. Is there a way to do this in or near ~10^8 or so operations?

    Read the article

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