formula

Formula Parser with Brackets

Hi folks, I need to implement a simple formula parser. What I am doing is first create a postfix notation and then evaluating the postfix string. Unfortunately, this algorithm doesn't allow brackets i.e. (2+3)*a. Anyone knows how to extend the algorithm to allow brackets? Thanks in advance, Frank ...

Need the excel formula for following function

Hi Geeks, I need help to do the following function in a MS Excel sheet. The sheet example is as follows A B C D E 1 TimeStamp Name Amount UsedBy Description ----------------------------------------------------------- 2 Date1 Me1 200 ...

excel empty string formula

On Excel why putting a formula with the contents ="" sometimes make the replacement for an empty string and sometimes it places literally that text in the cell. Note: every cell of the worksheet is in the text format. ...

Solving a cubic to find nearest point on a curve to a point...

Ok, I have a projectile that has its position defined such that: a.x = initialX + initialDX * time; a.y = initialY + initialDY * time + 0.5 * gravtiy * time^2; I want to be able to predict which obstacles in my environment this projectile will collide with. I plan on checking the distance from A the closest point on the curve to th...

Given "T, total number" and "N, number of days", how to divide T by N so that n1 + n2... equals T in an exponential curve?

I'm creating dummy data for an app, and want to simulate exponential growth while also knowing the final number. So here's the proposal: Given T = 2000. Total number of "counts" an event will have occurred. And N = 7. Days of the week: 7.days.ago.day..Time.now.day. What is the simplest formula for dividing T by N such that we create...

Prime Number Formula

I am trying to write a prime number function in C# and I am wondering if the follow code will work. It "appears" to work with the first 50 numbers or so. I just want to make sure it will work no matter how big the number is: static bool IsPrime(int number) { if ((number == 2) || (number == 3) || (number == 5) || (number == 7) || (nu...

What -- does in Excel?

Hey, Trying to decipher some Excel formulas and I see some stuff like SUMPRODUCT(--Left(...)...) What is the -- doing? Naturally seems like decrementing to me but couldn't find any documentation on it. Thanks. ...

Native SQL query for an Hibernate entity using @Formula results in NullPointerException

I've got an simple Hibernate entity for which I use the @Formula annotion: @Id private Long id; private String name; @Formula("(select count(f.*) from foo f where f.id = id)") private long bar; When I try to load an entity with a native SQL Query: EM.createNativeQuery("SELECT f.*, count(something) as bar FROM foo f WHERE f.name...

How to mitigate against bandwagon effect (voting behavior) in my ranking system?

What I mean by bandwagon effect describes itself like so: Already top-ranked items have a higher tendency to get voted on at all, possibly even to get upvoted. What I am hoping to get is some concrete recommendations, at best based on your practical experience with a mathematical formula and in which situation it helped. However, any u...

Calculate Height for Image/Video based on Aspect Ratio and Width

I have a width: 240 I have aspect ratio: 2.40 I need to get the height based on those two variables. What's the formula? ...

Can I enter formula in the column for MySQL database?

I wonder if the above can operate the column like the excel. eg. same row. column 1 : A, column 2 : b, column 3 : A + b. ...

Excel: what is the unit in date type series used in functions

Hi there, dumb questions (but I did google around and searched SO): I'm using the SLOPE Excel function on a date data type time series: 1 jan, 1 feb, 1 mar and so on... I can't figure out the x axis time unit assumed in the resulting calculation so the number is quite useless to me. Any hints? Cheers, Edoardo ...

Dissolve string bytes into a fixed length formula based pattern by using keys, and even extract those bytes.

Suppose there is a string containing 255 characters. And there is a fixed length assume 64-128 bytes a kind of byte pattern. I want to "dissolve" that string with 255 characters, byte by byte into the other fixed length byte pattern. The byte pattern is like a formula based "hash" or something similar into which a formula based algorithm...

formulae / algorithm to select centre cells in a grid?

If I have a grid say consisting of 15 x 15 cells (but variable), what formulae or algorithm would I use to randomly select 20 cells clustered around the centre cell? I guess I would ideally like to be able to set the centre point, cluster radius, density etc... any pointers would be really appreciated! cheers. ...

excel - true vs "true" vs true()

When writing an Excel formula, does it make a difference whether you set a value to true, "true", or true()? In other words, which of the following is the best? Or does it depend on the circumstances? if (A1 = 1, true, false) if (A1 = 1, "true", "false") if (A1 = 1, true(), false()) ...

How to find original values back from the final result output of the sequential Xor procedures?

The problem is that I want to get the original values of B, or the original value of C or A. Here is the code: Dim strA As String = "A" Dim strB As String = "B" Dim strC As String = "C" Dim result As Byte = 0 ' Fetch the byte character code of strings and Xor them all into the result in a sequence. result = resu...

Excel countif where criteria is on separate columns

A B C 1 Fruit 0.34 Pear 2 Vegetable 0.62 Lettuce 3 Fruit 0.80 Apple 4 Fruit 0.86 Banana Given the table above, I need to know the cost of all items above by type (fruits vs vegetables). In the above example, I'm looking for a formula that gives me Fruits=2.0 and Vegetab...

What is this Excel formula doing?

Can someone please explain in English wtf this formula is doing? I'm looking at someone else's work and have no idea. =SUM(OFFSET(INDIRECT((ADDRESS(ROW(),21)),0,0,1)CurrentActualPeriod)) ...

Can I express these conditionals with a single math formula?

Not sure of the best way to ask this question other than: I'm writing a function that will accept a variable called 'x'. function doIt(x){ var y = someformula; //this is just a placeholder for the correct formula return y; } And here's what I expect returned: if (x is between 0 and 9){ y = 0; } if (x is between 10 and 19){ y = ...

How to do a fractional power on BigDecimal in Java?

In my little project I need to do something like Math.pow(7777.66, 5555.44) only with VERY big numbers. I came across a few solutions: - Use double - but the numbers are too big - Use BigDecimal.pow but no support for fractional - Use the X^(A+B)=X^A*X^B formula (B is the remainder of the second num), but again no support for big X or bi...