Search Results

Search found 1803 results on 73 pages for 'pi calculation'.

Page 36/73 | < Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >

  • upload data and save it using ASIHTTP

    - by Srt
    I have a web page in which a value 'A' is constantly updated. I use ASIHttp to access the page contents and get this value 'A'. Based on A i calculate value X and i then i need to save this X to a webpage. I am able to get the data and am doing the calculation to get X. How do i upload and save the X to a webpage using ASIHTTP so that the X value can be used later. Thanks in advance.

    Read the article

  • Good Package for Fitting Polynomial Trend Lines

    - by Rev316
    Given a simple data set, I would like to be able to calculate a trending formula given it's a second order polynomial regression. In fact, it would be great if one could even forecast X periods during calculation (similar to what Excel does). I'm looking for a portable C/C++ package that's relatively easy to use, and allows it to spit out the "best-fit" (highest R^2 value) curve. Any suggestions? Thanks!

    Read the article

  • How to implement a custom cell renderer for ScrollTable in GWT

    - by tronda
    I've used the ScrollTable widget for GWT and I have a need for a custom cell renderer so I can isolate this code from the rest of the app. I would like to use generics if possible to get it type safe. This cell renderer will take a long as a value and do some calculation before displaying the result. Anyone having a good example on how to implement such a custom renderer?

    Read the article

  • how is google Calculator implemented ?

    - by AlgoMan
    When you search in Google "100F to C" how does it know to convert from Fahrenheit to Celsius. Similarly, conversion from different currencies and simple calculation. What is the data structure used. Or is it simple pattern matching the strings ?

    Read the article

  • Averaging initial values for rolling series

    - by Dave Jarvis
    Question Given a maximum sliding window size of 40 (i.e., the set of numbers in the list cannot exceed 40), what is the calculation to ensure a smooth averaging transition as the set size grows from 1 to 40? Problem Description Creating a trend line for a set of data has skewed initial values. The complete set of values is unknown at runtime: they are provided one at a time. It seems like a reverse-weighted average is required so that the initial values are averaged differently. In the image below the leftmost data for the trend line are incorrectly averaged. Current Solution Created a new type of ArrayList subclass that calculates the appropriate values and ensures its size never goes beyond the bounds of the sliding window: /** * A list of Double values that has a maximum capacity enforced by a sliding * window. Can calculate the average of its values. */ public class AveragingList extends ArrayList<Double> { private float slidingWindowSize = 0.0f; /** * The initial capacity is used for the sliding window size. * @param slidingWindowSize */ public AveragingList( int slidingWindowSize ) { super( slidingWindowSize ); setSlidingWindowSize( ( float )slidingWindowSize ); } public boolean add( Double d ) { boolean result = super.add( d ); // Prevent the list from exceeding the maximum sliding window size. // if( size() > getSlidingWindowSize() ) { remove( 0 ); } return result; } /** * Calculate the average. * * @return The average of the values stored in this list. */ public double average() { double result = 0.0; int size = size(); for( Double d: this ) { result += d.doubleValue(); } return (double)result / (double)size; } /** * Changes the maximum number of numbers stored in this list. * * @param slidingWindowSize New maximum number of values to remember. */ public void setSlidingWindowSize( float slidingWindowSize ) { this.slidingWindowSize = slidingWindowSize; } /** * Returns the number used to determine the maximum values this list can * store before it removes the first entry upon adding another value. * @return The maximum number of numbers stored in this list. */ public float getSlidingWindowSize() { return slidingWindowSize; } } Resulting Image Example Input The data comes into the function one value at a time. For example, data points (Data) and calculated averages (Avg) typically look as follows: Data: 17.0 Avg : 17.0 Data: 17.0 Avg : 17.0 Data: 5.0 Avg : 13.0 Data: 5.0 Avg : 11.0  Related Sites The following pages describe moving averages, but typically when all (or sufficient) data is known: http://www.cs.princeton.edu/introcs/15inout/MovingAverage.java.html http://stackoverflow.com/questions/2161815/r-zoo-series-sliding-window-calculation http://taragana.blogspot.com/ http://www.dreamincode.net/forums/index.php?showtopic=92508 http://blogs.sun.com/nickstephen/entry/dtrace_and_moving_rolling_averages

    Read the article

  • Floating point vs integer calculations on modern hardware

    - by maxpenguin
    I am doing some performance critical work in C++, and we are currently using integer calculations for problems that are inherently floating point because "its faster". This causes a whole lot of annoying problems and adds a lot of annoying code. Now, I remember reading about how floating point calculations were so slow approximately circa the 386 days, where I believe (IIRC) that there was an optional co-proccessor. But surely nowadays with exponentially more complex and powerful CPUs it makes no difference in "speed" if doing floating point or integer calculation? Especially since the actual calculation time is tiny compared to something like causing a pipeline stall or fetching something from main memory? I know the correct answer is to benchmark on the target hardware, what would be a good way to test this? I wrote two tiny C++ programs and compared their run time with "time" on Linux, but the actual run time is too variable (doesn't help I am running on a virtual server). Short of spending my entire day running hundreds of benchmarks, making graphs etc. is there something I can do to get a reasonable test of the relative speed? Any ideas or thoughts? Am I completely wrong? The programs I used as follows, they are not identical by any means: #include <iostream> #include <cmath> #include <cstdlib> #include <time.h> int main( int argc, char** argv ) { int accum = 0; srand( time( NULL ) ); for( unsigned int i = 0; i < 100000000; ++i ) { accum += rand( ) % 365; } std::cout << accum << std::endl; return 0; } Program 2: #include <iostream> #include <cmath> #include <cstdlib> #include <time.h> int main( int argc, char** argv ) { float accum = 0; srand( time( NULL ) ); for( unsigned int i = 0; i < 100000000; ++i ) { accum += (float)( rand( ) % 365 ); } std::cout << accum << std::endl; return 0; } Thanks in advance!

    Read the article

  • WinForms binding

    - by Anthony
    I have some controls bound to a BindingSource control. I want to do a calculation when the value changes in one control and set the result on another control. Do i update the textbox the property is bound to or do i update the underlying entity which would update the control anyway(i hope)? When i change textbox A...textbox B is updated with the new calculated result..this works fine...but i have noticed that when i Leave textbox A..textbox B reverts back to its original value...what is going on here!

    Read the article

  • actionscript 2.0:Check TextField in flash

    - by RedsDevils
    I have some problem in check two textfield.text comparison. One TextField.text value is come from calculation and the other textField is from user input. When I check those two text, the TextField.text value didn't show and I can't compare those two. How can I compare in actionscript 2.0. Please Help me! Thanks in advance!

    Read the article

  • Parallel computing for integrals

    - by Iman
    I want to reduce the calculation time for a time-consuming integral by splitting the integration range. I'm using C++, Windows, and a quad-core Intel i7 CPU. How can I split it into 4 parallel computations?

    Read the article

  • Is there any web service for getting tidal information?

    - by thor
    Has anyone come across a web service or plugin/code/calculation for getting information on tides - namely high and low tide times? I only need this information for one location (outwith the US) but I need it on an ongoing basis so a web service that I can hit once a day or something would be ideal.

    Read the article

  • are deleted entries counted in the load factor of a hash table using open addressing

    - by Dr. Monkey
    When calculating the load factor of a hashtable with an open-addressing array implementation I am using: numberOfKeysInArray/sizeOfArray however it occurred to me that since deleted entries must be marked as such (to distinguish them from empty spaces), it might make sense to include these in the number of keys. My thinking is that as far as estimating the average number of probes to find an entry, deleted entries should count towards the load factor, but as far as inserting a new key they should not. Which is the proper calculation: including deleted keys or not?

    Read the article

  • PHP Calculating future date by adding days to a variable date

    - by OneNerd
    I was looking at this post, and it is close to what I need: http://stackoverflow.com/questions/1669165/php-how-to-count-60-days-from-the-add-date However, in that post, the calculation is performed by adding 60 days to the current date. What I need to do is calculate the date based on a variable date (and not the current date). Something like this: $my_date = $some_row_from_a_database; $date_plus_10_days = ???; Anyone know how to do that? Thanks

    Read the article

  • Elliptic Curve Diffie-Hellman

    - by cmaduro
    Does the Elliptic curve diffie hellman calculation look any different from the standard one defined here: /* * The basic Diffie-Hellman Key Agreement Equation * * The client initiates * A = g^a mod p * * Sends (g p A) to the server * * The server calculates B * B = g^b mod p * * Sends B back to client * * The client calculates K * K = B^a mod p * * The server calucaltes K * K = A^b mod p * */ Or is it just a specific way of selecting g, a, p and b? How are g,a,p and b selected anyway?

    Read the article

  • Is there a Java library with 3D spline functions?

    - by Liam
    In particular, I need a way to represent a curve/spline that passes through a set of known 3D points, and a way of finding other points on the curve/spline, by subdivision/interpolation. For example, if I have a set of points P0 to PN, I want to find 100 points between P0 and P1 that are on a spline that passes through P0 and P1. I see that Java3D's KBRotPosScaleSplinePathInterpolator performs such a calculation, but it is tied to that API's scenegraph model and I do not see how to return the values I need.

    Read the article

  • HT create a new vector in data frame that takes correlation of existing vectors

    - by Milktrader
    I have a time series of two indexes, with each row representing the closing price on the same day. I'd like to go to row 30 and lookback over the last 30 'days' and calculate the pearson correlation. And then store that value in a new vector. Then, repeat the calculation for the entire time series. It is a trivial task in Excel, so I'm convinced it can be done in R. I don't know the method to use though.

    Read the article

  • Java - simple division in Java ---> bug/feature?!

    - by msr
    Hello, Im astonished. Im trying this simple calculation in a Java application: System.out.println("b=" + (1 - 7/10)); Obviously Im wainting for "b=0.3" in the output but here's what I get: b=1 What?! Why this happens? If I make: System.out.println("b=" + (1-0.7)); I get the right result which is "b=0.3". What's going wrong here? Thanks!

    Read the article

  • hibernate sybase db power function

    - by Vipin Thomas
    We are trying to use sybase function power to do mathematical calculation for one of the DB columns. The hibernate is generating power function as pow(?, xyzo0_.AmtScale) whereas sybase supports power function as Syntax POWER( numeric-expression-1, numeric-expression-2 ) We have tried modifying the hibernate.dialect. Have tried org.hibernate.dialect.SybaseASE15Dialect org.hibernate.dialect.Sybase11Dialect org.hibernate.dialect.SybaseAnywhereDialect but all dialects generate the power function as pow(?, xyzo0_.AmtScale). Is this hibernate issue or are we missing something?

    Read the article

  • Round date to fiscal year

    - by Dave Jarvis
    The following database view rounds the date back to the closest fiscal year (April 1st): CREATE OR REPLACE VIEW FISCAL_YEAR_VW AS SELECT CASE WHEN to_number(to_char( SYSDATE, 'MM' )) < 4 THEN to_date('1-APR-'||to_char(add_months(SYSDATE, -12), 'YYYY'), 'dd-MON-yyyy') ELSE to_date('1-APR-'||to_char(SYSDATE, 'YYYY'), 'dd-MON-yyyy') END AS fiscal_year FROM dual; This allows us to calculate the current fiscal year based on today's date. How can this calculation be simplified or optimized?

    Read the article

  • Java - simple division in Java ---> bug?!

    - by msr
    Hello, Im astonished. Im trying this simple calculation in a Java application: System.out.println("b=" + (1 - 7/10)); Obviously Im wainting for "b=0.3" in the output but here's what I get: b=1 What?! Why this happens? If I make: System.out.println("b=" + (1-0.7)); I get the right result which is "b=0.3". What's going wrong here? Thanks!

    Read the article

< Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >