EzDevInfo.com

formula.js

JavaScript implementation of most Microsoft Excel formula functions

Convert light frequency to RGB?

Does anyone know of any formula for converting a light frequency to an RGB value?


Source: (StackOverflow)

How do I brew update a formula?

How do i update a formula?

I ran brew update. Then, running brew outdated, outputs:

mongodb (1.4.3-x86_64 < 1.6.5-x86_64)

Thus, mongodb is outdated.

How do I upgrade it? Do I just uninstall and then install?


Source: (StackOverflow)

Advertisements

Excel: Fast way to determine if a cell (value) is used in any formula

I am trying to reverse engineer an ancient program written using VBA in excel and formulas in cells. There are many cells with values scattered across everywhere. Is there a fast way to check if a cell (value) is being used in another cell's forumla; or if the cell is just sitting there doing nothing so that I can delete/igonore it safely? Thanks in advance.

Edit: I used the ctrl+F find tool and it seems like it does work, but I just want to be sure if there is another better way.


Source: (StackOverflow)

Using relative positions in Excel formulas

How do I create a formula that isn't made invalid when I delete a row.

For example in cell F12 I have the formula: =F11+D12-E12

This basically says take the value from the cell above then add the value of the cell 2 to the left and subtract the value in the cell directly to the left.

However, because I'm using actual cell addresses, as soon as I delete a row, all the rows below become invalid.

How do i express the formula by relative position (ie = "1 above" + "2 to left" - "1 to left")

Thanks.


Source: (StackOverflow)

Formula px to dp, dp to px android

I am trying to calculate a variable amount of pixels to density independent pixels and vice-versa.

This formula (px to dp): dp = (int)(px / (displayMetrics.densityDpi / 160)); does not work on small devices because it is divided by zero.

This is my dp to px formula:

px = (int)(dp * (displayMetrics.densityDpi / 160));

Could someone give me some pointers?

Thanks in advance.

Kind regards, Bram


Source: (StackOverflow)

Simulate string split function in Excel formula

I am trying to split a string in an excel formula, something like I can do in many programming languages, e.g.

string words = "some text".split(' ');

The problem is that I can't be sure that there is more than one word in the cell. If I try to use the FIND() or SEARCH() functions, they return #VALUE if there is not space. Is there any easy way to split the string so that it returns the individual words (or even better, so that it returns either the first word or all the other words)?


Source: (StackOverflow)

How to get all possible years from the given day, day of the week, and month?

I want to get the set of years which pertain to a specific date, week of the day and month. There are possibilities that I can get various years from this pattern. Suppose Date is 15, Month is August and Week of the day is Tuesday then, How would I find the years that are valid? Is there a formula for this?


Source: (StackOverflow)

Too many 'if' statements?

The following code does work how I need it to, but it's ugly, excessive or a number of other things. I've looked at formulas and attempted to write a few solutions, but I end up with a similar amount of statements.

Is there a type of math formula that would benefit me in this instance or are 16 if statements acceptable?

To explain the code, it's for a kind of simultaneous-turn-based game.. two players have four action buttons each and the results come from an array (0-3), but the variables 'one' & 'two' can be assigned anything if this helps. The result is, 0 = neither win, 1 = p1 wins, 2 = p2 wins, 3 = both win.

public int fightMath(int one, int two) {

    if(one == 0 && two == 0) { result = 0; }
    else if(one == 0 && two == 1) { result = 0; }
    else if(one == 0 && two == 2) { result = 1; }
    else if(one == 0 && two == 3) { result = 2; }
    else if(one == 1 && two == 0) { result = 0; }
    else if(one == 1 && two == 1) { result = 0; }
    else if(one == 1 && two == 2) { result = 2; }
    else if(one == 1 && two == 3) { result = 1; }
    else if(one == 2 && two == 0) { result = 2; }
    else if(one == 2 && two == 1) { result = 1; }
    else if(one == 2 && two == 2) { result = 3; }
    else if(one == 2 && two == 3) { result = 3; }
    else if(one == 3 && two == 0) { result = 1; }
    else if(one == 3 && two == 1) { result = 2; }
    else if(one == 3 && two == 2) { result = 3; }
    else if(one == 3 && two == 3) { result = 3; }

    return result;
}

Source: (StackOverflow)

free Java library for evaluating math expressions [closed]

Is there a free and open source library for evaluating math expressions in Java?

In one of my projects I want to add a feature where the user can provide in a formula, for example

sin (x + pi)/2 + 1

which I use in my Java app

/**
 * The formula provided by the user
 */
private String formula; // = "sin (x + pi)/2 + 1"

/*
 * Evaluates the formula and computes the result by using the
 * given value for x
 */
public double calc(double x) {
    Formula f = new Formula(formula);
    f.setVar("x", x);
    return f.calc();
    // or something similar
}

Or do I have to write my own parser with antlr?


Source: (StackOverflow)

Formula with dynamic number of variables

Suppose, there is some data.frame foo_data_frame and one wants to find regression of the target column Y by some others columns. For that purpose usualy some formula and model are used. For example:

linear_model <- lm(Y~FACTOR_NAME_1+FACTOR_NAME_2, data_frame)

That does job well if the formula is coded staticaly. If it is desired to root over several models with the constant number of dependent variables (say, 2) it can be treated like that:

for (i in 1:factor_number) {
  for (j in (i+1):factor_number) {
    linear_model <- lm(Y~F1+F2, list(Y=data_frame$Y, F1=data_frame[[i]], F2=data_frame[[j]]))
    # linear_model further analyzing...
  }
}

My question is how to do the same affect when the number of variables is changing dynamicly during program running?

for (number_of_factors in 1:5) {
   # then root over subsets with #number_of_factors cardinality
   for (factors_subset in all_subsets_with_fixed_cardinality) {
     # here I want to fit model with factors from factors_subset.
     linear_model <- lm(Does R provide smth to write here?)
   }
}

Thank you.


Source: (StackOverflow)

Base64 length calculation?

After reading (again )the base 64 topic ...

I'm trying to figure How the formulla is working :

Given a string with length of n , the base64 length will be enter image description here

which is : 4*Math.Ceiling(((double)s.Length/3)))

I already know that base64 length must be %4==0 to allow the decoder know what was the original text length.

The max number of padding for a sequesnce can be = or ==.

wiki :The number of output bytes per input byte is approximately 4 / 3 (33% overhead)

How does the information above settles with the output length enter image description here ?

Thanks.


Source: (StackOverflow)

Turn a string formula into a "real" formula

I got "0,4*A1" in a cell (As a string) and in another cell I want to convert this "string formula" into a real formula and calculate its value, how can I do it??


Source: (StackOverflow)

LaTeX equivalent to Google Chart API

I'm currently looking at different solutions getting 2 dimensional mathematical formulas into webpages. I think that the wikipedia solution (generating png images from LaTeX sourcecode) is good enough until we get support for MathML in webbrowsers.

I suddenly realized that it might be possible to create a Google Charts API equivalent for mathformulas. Has this already been done? Is it even possible due to the strange characters involved in LaTeX-code?

I would like to hit an url like latex2png.org/api/?eq="E = mc^2" and get the following response: e=mc^2

edit: Thanks for the answers sofar. However, I am already aware of several tools to generate png images from latex source code (both online and from my commandline), but what I was looking for was a simple way to get the image via an Http GET request. Perhaps such a service does not exist.


Source: (StackOverflow)

short formula call for many variables when building a model

I am trying to build a regression model with lm(...). My dataset has lots of features(>50). I do not want to write my code as lm(output~feature1+feature2+feature3+...+feature70). I was wondering what is the short hand notation to write this code.


Source: (StackOverflow)

Count Unique values with a condition

In column A I have list of different names. In column B, I have values either 0 or 1.

I want to get a count of all the unique names from column A which have 1 in column B.

Using below array formula I am able count unique names but not able to apply condition on column B.

=SUM(1/COUNTIF(A:A,A:A))

Source: (StackOverflow)