Search Results

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

Page 40/137 | < Previous Page | 36 37 38 39 40 41 42 43 44 45 46 47  | Next Page >

  • Inverse relationship of two variables

    - by Jam
    this one is maybe pretty stupid.. Or I am just exhausted or something, but I just cant seem to solve it.. Problem : two variables X and Y, value of Y is dependent on value of X. X can have values ranging from some value to some value (lets say from 0 to 250) and y can have different values (lets say from 0.1 to 1.0 or something..) - but it is inverse relatonship (what I mean is: if value of X is e.g. 250, then value of Y would be 0.1 and when X decreases up to 0, value of Y raises up to 1.0.. So how should I do it? lets say I have function: -- double computeValue (double X) { /computation/ return Y; } Also, is there some easy way to somehow make the scaling of the function not so linear? - For example when X raises, Y decreases slower at first but then more rapidly in the end.. (rly dont know how to say it but I hope you guys got it) Thanks in advance for this stupid question :/

    Read the article

  • Adding Colours (Colors) Together like Paint (Blue + Yellow = Green, etc)

    - by glenstorey
    I'm making an iOS game using cocos2d libraries. Lets say you have two objects that have two separate colours - defined in RGB as Blue: 0,0,255 Yellow: 255,255,0 I want to add blue and yellow to make green. To over complicate things, let's say that the Blue object is bigger than the Yellow object (for the sake of argument let's say that the ratio is 2:1), I'm adding twice as much blue as yellow - how to I calculate this new (light green) colour correctly. I understand LAB * Color Space is useful for this sort of 'natural colour' kind of thing, but I'm not sure how to use it - especially in the context of a cocos2d object which (AFAIK) is limited to using RGB in its colour schemes. I'd really appreciate practical help on how to implement this. Thanks heaps!

    Read the article

  • integer division in php

    - by oezi
    hi guys, i'm looking for the fastest way to do an integer division in php. for example, 5 / 2 schould be 4 | 6 / 2 should be 3 and so on. if i simply do this, php will return 2.5 in the first case, the only solution i could find was using intval($my_number/2) - wich isn't as fast as i want it to be (but gives the expected results). can anyone help me out with this?

    Read the article

  • (Ordered) Set Partitions in fixed-size Blocks

    - by Eugen
    Here is a function I would like to write but am unable to do so. Even if you don't / can't give a solution I would be grateful for tips. For example, I know that there is a correlation between the ordered represantions of the sum of an integer and ordered set partitions but that alone does not help me in finding the solution. So here is the description of the function I need: The Task Create an efficient* function List<int[]> createOrderedPartitions(int n_1, int n_2,..., int n_k) that returns a list of arrays of all set partions of the set {0,...,n_1+n_2+...+n_k-1} in number of arguments blocks of size (in this order) n_1,n_2,...,n_k (e.g. n_1=2, n_2=1, n_3=1 -> ({0,1},{3},{2}),...). Here is a usage example: int[] partition = createOrderedPartitions(2,1,1).get(0); partition[0]; // -> 0 partition[1]; // -> 1 partition[2]; // -> 3 partition[3]; // -> 2 Note that the number of elements in the list is (n_1+n_2+...+n_n choose n_1) * (n_2+n_3+...+n_n choose n_2) * ... * (n_k choose n_k). Also, createOrderedPartitions(1,1,1) would create the permutations of {0,1,2} and thus there would be 3! = 6 elements in the list. * by efficient I mean that you should not initially create a bigger list like all partitions and then filter out results. You should do it directly. Extra Requirements If an argument is 0 treat it as if it was not there, e.g. createOrderedPartitions(2,0,1,1) should yield the same result as createOrderedPartitions(2,1,1). But at least one argument must not be 0. Of course all arguments must be = 0. Remarks The provided pseudo code is quasi Java but the language of the solution doesn't matter. In fact, as long as the solution is fairly general and can be reproduced in other languages it is ideal. Actually, even better would be a return type of List<Tuple<Set>> (e.g. when creating such a function in Python). However, then the arguments wich have a value of 0 must not be ignored. createOrderedPartitions(2,0,2) would then create [({0,1},{},{2,3}),({0,2},{},{1,3}),({0,3},{},{1,2}),({1,2},{},{0,3}),...] Background I need this function to make my mastermind-variation bot more efficient and most of all the code more "beautiful". Take a look at the filterCandidates function in my source code. There are unnecessary / duplicate queries because I'm simply using permutations instead of specifically ordered partitions. Also, I'm just interested in how to write this function. My ideas for (ugly) "solutions" Create the powerset of {0,...,n_1+...+n_k}, filter out the subsets of size n_1, n_2 etc. and create the cartesian product of the n subsets. However this won't actually work because there would be duplicates, e.g. ({1,2},{1})... First choose n_1 of x = {0,...,n_1+n_2+...+n_n-1} and put them in the first set. Then choose n_2 of x without the n_1 chosen elements beforehand and so on. You then get for example ({0,2},{},{1,3},{4}). Of course, every possible combination must be created so ({0,4},{},{1,3},{2}), too, and so on. Seems rather hard to implement but might be possible. Research I guess this goes in the direction I want however I don't see how I can utilize it for my specific scenario. http://rosettacode.org/wiki/Combinations

    Read the article

  • Reverse engineering a bezier curve

    - by Martin
    Given a few sample points on a bézier curve, is it possible to work out the set of possible parameters of the curve? In my specific application there is a limited set of endpoints the curve may have, so I want to generate the set of possible curves, enumerate all of them and pick out all the ones which may end on a valid end point.

    Read the article

  • How to maintain decimal precision in calculations

    - by Blankman
    I need to sum 2 decimal values together, then divide by 2 and convert to string. My calculation currently is trimming to 2 decimal places, but I want to keep as many decimals as I can. city.Latitude = ( (lat.North + lat.South) / 2 ).ToString(); the values for lat.North and lat.Souch are like: 55.32342322

    Read the article

  • Calculating intraday candlesticks by time intervals

    - by Sam
    This maybe an over asked question, but my mind draws blank at this moment. I know what a candlestick chart is and how to draw it daily. But how to draw it intraday at asked time periods. I have this server, written in Java, that gives me trade depth (each trade done since the start of the day). Its just a stream of raw data: price, shares, timestamp. How does one go about calculating candlestick data from that? Lets say, they want to have 5 min candlestick or 1min candlestick. Or is there a library that will do that for me if I feed it data? Any help is appreciated!

    Read the article

  • XNA Track rotated pixel positions

    - by jonny adams
    Hi, Im making a game in xna where a tank has to move over a landscape. I need to be able find the bottom of the tank when it is rotated so I can make it move up and down as the player goes over the landscape. for example if i have a sprite at with its top left corner at 400,300 and i rotate it around its center by 45 degrees around its center, how do i find the new locations of the bottom track. Thanks

    Read the article

  • Function to get X, Y position of an object orbiting a point, given a distance and angle in radians?

    - by Jake Petroules
    I am trying to code a function for a camera that orbits a point. Assume a 3d coordinate plane where Z is up. Ignore Z. Let's say the camera's position starts at (0, 0, z). The object to orbit is at, say (50, 50, z). So we have a distance of ~70 units. Calling the function with {(50, 50, z), 70, x} where x is the position in orbit, in radians, should return where the position of the camera should be. I believe this involves cos and tan but my trig isn't that great... point3d getCameraPosition(point3d objectPosition, float distance, float rotationRadians) { // ??? }

    Read the article

  • If we make a number every millisecond, how much data would we have in a day?

    - by Roger Travis
    I'm a bit confused here... I'm being offered to get into a project, where would be an array of certain sensors, that would give off reading every millisecond ( yes, 1000 reading in a second ). Reading would be a 3 or 4 digit number, for example like 818 or 1529. This reading need to be stored in a database on a server and accessed remotely. I never worked with such big amounts of data, what do you think, how much in terms of MBs reading from one sensor for a day would be?... 4(digits)x1000x60x60x24 ... = 345600000 bits ... right ? about 42 MB per day... doesn't seem too bad, right? therefor a DB of, say, 1 GB, would hold 23 days of info from 1 sensor, correct? I understand that MySQL & PHP probably would not be able to handle it... what would you suggest, maybe some aps? azure? oracle? ... Thansk!

    Read the article

  • Can someone explain how this works?

    - by Dan Howard
    Key in the first three digits of your phone number (NOT the Area code...) Multiply by 80 Add 1 Multiply by 250 Add to this the last 4 digits of your phone number Add to this the last 4 digits of your phone number again. Subtract 250 Divide number by 2 Do you recognize the answer??

    Read the article

  • Treating differential operator as algebraic entity

    - by chappar
    I know that this question is offtopic and don't belong here. But i didn't know somewhere else to ask. So here is the question. I was reading e:the story of a number by Eli Maor, where he treats differential operator as just like any algebraic entity. For example if we have a differential equation like y’’ + 5y’ - 6y = 0. This can be treaed as (D^2 + 5D – 6)y = 0. So, either y = 0 (trivial solution) or (D^2 + 5D – 6) = 0. Factoring out above equation we get (D-1)(D+6)= 0 with solutions as D = 1 and D = -6. Since D does not have any meaning on its own, multiplying by y on both the sides we get Dy = y and Dy = -6y for which the solutions are Ae^x and Be^-6x. Combining these 2 solutions we get Ae^x + Be^-6x. Now my doubt is this approach break when we have an equation like D^2y = 0. Which means y = 0 (again trivial) or D^2 = 0 which means D = 0. Now Dy = y*0 = 0. That means y = C ( a constant). The actual answer should be Cx. I know that it is stupidity to treat D^2 = 0 as D = 0, it led me to doubt the entire process of treating differential equation as algebraic equation. Can someone throw light on this? Or any other site where i might get answer?

    Read the article

  • Looking for interesting formula

    - by Thinker
    I'm creating a game where players can make an alloy. To make it less predictable and more interesting, I thought that the durability and hardness of an alloy should not be calculated by a simple formula, because it will be extremely easy to find extrema, where alloy have best statistics. So the questions is, is there any formula for a function where extrema can be found only by investigating all points? Input values will be in percents: 0.0%-100.0%. I think it should look like this: half sound wave

    Read the article

  • Calculating distance from latitude, longitude and height using a geocentric co-ordinate system

    - by Sarge
    I've implemented this method in Javascript and I'm roughly 2.5% out and I'd like to understand why. My input data is an array of points represented as latitude, longitude and the height above the WGS84 ellipsoid. These points are taken from data collected from a wrist-mounted GPS device during a marathon race. My algorithm was to convert each point to cartesian geocentric co-ordinates and then compute the Euclidean distance (c.f Pythagoras). Cartesian geocentric is also known as Earth Centred Earth Fixed. i.e. it's an X, Y, Z co-ordinate system which rotates with the earth. My test data was the data from a marathon and so the distance should be very close to 42.26km. However, the distance comes to about 43.4km. I've tried various approaches and nothing changes the result by more than a metre. e.g. I replaced the height data with data from the NASA SRTM mission, I've set the height to zero, etc. Using Google, I found two points in the literature where lat, lon, height had been transformed and my transformation algorithm is matching. What could explain this? Am I expecting too much from Javascript's double representation? (The X, Y, Z numbers are very big but the differences between two points is very small). My alternative is to move to computing the geodesic across the WGS84 ellipsoid using Vincenty's algorithm (or similar) and then calculating the Euclidean distance with the two heights but this seems inaccurate. Thanks in advance for your help!

    Read the article

  • Is OOP based on any branch of mathematics?

    - by ektrules
    I know relational databases are based on set-theory, functional programming is based on lambda calculus, logic programming is based on logic (of course :)), and now that I think of it; I'm not sure if imperative and generic programming is based on any particular branch of mathematics either.

    Read the article

  • Implementing a hilbert map of the internet

    - by Martin
    In the XKCD comic 195 a design for a map of the internet address space is suggested using a hilbert curve so that items from a similar IPs will be clustered together. Given an IP address, how would I calculate the 2D coordinates (in the range zero to one) that this IP is located on such a map?

    Read the article

  • PHP given a series of arbitrary numbers, how can I choose a logical max value on a line graph?

    - by stormist
    I am constructing a line graph in PHP. I was setting the max value of the line graph to the max value of my collection of items, but this ended up making the graph less readable you are unable to view the highest line on the graph as it intersects with the top of it. So what I need is basically a formula to take a set of numbers and calculate what the logical max value of on the line graph should be.. so some examples 3500 250 10049 45394 434 312 Max value on line graph should probably be 50000 493 412 194 783 457 344 max value on line graph would ideally be 1000 545 649 6854 5485 11545 In this case, 12000 makes sense as max value So something as simple as rounding upward to the nearest thousandth might work but I'd need it to progressively increase as the numbers got bigger. (50000 instead of 46,000 in first example) The maximum these numbers will ever be is about a million. Any recommendations would be greatly appreciated, thank you.

    Read the article

  • How can I accelerate the generation of the an MD5 Checksum within vb.net?

    - by Richard
    I'm working with some very large files residing on P2 (Panasonic) cards. Part of the process we employ is to first generate a checksum of the file we are going to copy, then copy the file, then run a checksum on the file to confirm that it copied OK. The problem is, is that files are large (70 GB+) and take a long time to complete. It's an issue since we will eventually be dealing with thousands of these files. I would like to find a faster way to generate the checksum other than using the System.Security.Cryptography.MD5CryptoServiceProvider I don't care if this means using a specialized hardware card, provided it works and is not to ungodly expensive. I would prefer to have a method of encoding that provided some feedback as to how far the process has gone along so I can display it like I do now. The application is written in vb.net. I would prefer to be able to use it as component, library, reference within my application, but I'm willing to call an outside application if there is enough improvement in the speed of generating the checksum. Needless to say, the checksum must be consistent and correct. :-) Thank you in advance for your time and efforts, Richard

    Read the article

  • Scientific Algorithms that can produce imagery, pseudocode perhaps?

    - by Ross
    Hello, I have a client who are based in the field of mathematics. We are developing, amongst other things, a website. I like to create a mock-up of a drawing tool that an produce some imagery in the background based on some scientific algorithms. The intention being that the may client, later, may create there own. (They use emacs for everything, great client.) I'm look for an answer of where or what to go looking for. Not code specific, pseudocode even, as we can adapt and have not yet settled on a platform. I'm afraid my mathematic stops at the power of two and some trigonometry. Appreciated if they're are any mathematics related students/academics how could enlighten me? What to search for will be accepted? Edit: To summarise/clarify, I want to draw pretty pictures (the design perspective). I want them to have some context (i.e. not just for the sake of pretty images but have some explanation available). In essence I would to create a rendering engine which we can draw the images and we set the style parameters: line, colour, etc... But to pursue this option I want to experiment myself. Thanks Ross

    Read the article

  • simplify expression k/m%n

    - by aaa
    hello. Simple question, is it possible to simplify (or replace division or modulo by less-expensive operation) (k/m)%n where variables are integers and operators are C style division and modulo operators. what about the case where m and n are constants (both or just one), not based 2? Thank you

    Read the article

  • Detecting periodic repetitions in the data stream

    - by pulegium
    Let's say I have an array of zeros: a = numpy.zeros(1000) I then introduce some repetitive 'events': a[range(0, 1000, 30)] = 1 Question is, how do I detect the 'signal' there? Because it's far from the ideal signal if I do the 'regular' FFT I don't get a clear indication of where my 'true' signal is: f = abs(numpy.fft.rfft(a)) Is there a method to detect these repetitions with some degree of certainty? Especially if I have few of those mixed in, for example here: a[range(0, 1000, 30)] = 1 a[range(0, 1000, 110)] = 1 a[range(0, 1000, 48)] = 1 I'd like to get three 'spikes' on the resulting data...

    Read the article

< Previous Page | 36 37 38 39 40 41 42 43 44 45 46 47  | Next Page >