calculation

How to rotate a 3D tringle flat against the wall?

I'm working with 3D mesh data, where I have lots of 3D triangles which I need to rotate to eliminate the Z value, converting it to a 2D triangle. With this 2D triangle I'm doing some vector calculations. After I'm done with my work I need to rotate it back to the original angle such that the old points return back to their original pos...

PHP bizarre math

Hi, I'm very new to PHP...and I'm getting unexpected values for variable calculations: $var1 = $var2 * (((1 + $var3)^$var4)^$var5); I've verified that $var2 is 3, $var3 is 0.1, $var4 is 1, $var5 is 1.1 so, $var1 = 3*(((1+0.1)^1)^1.1) = 3.3316 but in PHP, $var1 = 3 if I change $var4 to 2, $var1 = 3*(((1+0.1)^1)^1.1) = 3.6999 but i...

Making my own Carbon Footprint Calculator

I'm trying create my own carbon footprint calculator, but I'm having trouble finding all the proper equations and such online, anyone know of any decent resources? ...

Calculate width and height of Flv and Swf using C#

Hi, I think the title says it all. I can't work out how to calculate the width and height dimensions of a .flv video or .swf file using C# .NET. Thanks in advance! ...

Excel correl() function with java?

Hi everybody, I need a clone of excel correl() function in java, I found apache math commons library that has some functions in org.apache.commons.math.stat.correlation package, but not sure if they are the same, some docs says that excel correl() function is very similar to PEARSON() excel function but not quite the same, anybody famil...

calculating age using calculator plugin/jquery

I have to sets of dates (via inputs/selects - mm/dd/yyy) on page. I want certain readonly text field to show age in months (calculated based on those two dates) after a certain select field (different select, not a part of dates set) has been changed (any option in that select chosen must trigger calculation and show result in readonly f...

Integers and Calculations

I'm working with integers and trying to do calculations that involve decimals at parts. I have used this same setup before and it had worked but for some reason this isn't working. package table.periodic; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android....

Simple middleware server for control and monitoring

Hello! I need a server. A simple one, to control a couple of computers. There are already a couple of programs in the lab, that perform some calculation and monitor tasks. They are executed on these computers. So I need a server to control them - to see the real time data from these computers, I want these programs to upload the calcula...

Is working with money (decimal numbers) in PHP considered safe?

I have an items table in my MySQL database with a DECIMAL(10,2) field called price. When fetching these values, is it safe to do calculations and such with these numbers in PHP? Or will I end up with potential rounding errors and things like that which are common when working with floating point data types? How does PHP handle these th...

Difference between two clock hours

So the scenario is as follows, I have two columns "StartHour" and "EndHour". Both are stored as Integers. F.ex values can be StartHour : 30 (clock time 00:30) and EndHour : 630 (clock time 06:30) The output I'd like from this is 360 (minutes). I need the difference between the two fields, and I need them in minutes. I can process the...

How to speedup & make the cells smooth scrolling in iPhone?

Hi, i did a text rendering program using UIView and UITableViewController. What i did is before going drawRect method, i just calculate all of the cells height as well as each text start & height,width. So that, i can estimate the cell height approximately and then i draw the text. I did this for both portrait & landscape mode. My progr...

c++ calculate all the angles between two angles

I have a set of previously defined float values(a set of angles) I need a function which takes two angles as input and returns all the angles between them. The user first enters a set of angles in float and then the user can enter any two angles(my program should return all the angles between these values) For example 30,310(return all ...

Strange calculation

Hello, I can't understand why does my program do such calculations: #define PixelsPerMeter 40.0 // 40 pixels ~ 1 meter #define Meters2Pixels(meters) (float)meters*PixelsPerMeter #define Pixels2Meters(pixels) (float)pixels/PixelsPerMeter // The speed of free falling #define G Meters2Pixels(9.81) // ... float mHeight = 768; float _wind...

Autosum and other calculations in word table - Mac

Is it possible to use bookmarks in calculations on Mac? I have the following working on word 2007 on PC: "=SUM(ABOVE)" <- and this cell have bookmark called "thesum" then in the cell under I have "=thesum * 0,25" <- this cell have a bookmark called "mva" then in the cell under again, I have "=mva+thesum" This works on PC but when I ...

MySQL Calculate Time Online

Would it be possible to calculate time online from a table of something like logtype time ---------------- login 2:30 logout 2:45 login 3:20 logout 4:50 login 5:00 login 5:10 logout 6:00 It would have extra logins because sometimes the server crashes and doesn't add logout. Can you do somethi...

How to write a query that calculates a value using a previous records value?

I'm trying to figure out the best way to calculate a value that is based on the previous records values. I'm sure it's possible, I just can't figure it out. Consider a table that has StartTime & EndTime. Along with these values is are 2 different types of wages: OnDuty & OffDuty. OnDuty = All time between StartTime and EndTime. ...

4D matrix calculation, Matlab coding problem

hey guys, I got some difficulty here. It is purely coding algorithm problem. Okay, the program is shown below: for f=1:(nFrames-1) h=histogram(imgYuv(:,:,1,f)); j=histogram(imgYuv(:,:,1,f+1)); X=abs(h-j)/256; %normalize the difference S=sum(X); end Basically, I want to calculate the difference between two adjacent elem...

Using shader for calculations

Is it possible to use shader for calculating some values and then return them back for further use? For example I send mesh down to GPU, with some parameters about how it should be modified(change position of vertices), and take back resulting mesh? I see that rather impossible because I haven't seen any variable for comunication from ...

How do I calculate altitude and azimuth of sun?

I'd like to calculate the position of the sun on a given date/time/position on earth? How would I calculate this? Or the time of sunrise/sunset? Or where can I find information about calculating the sun movement? ...

Generate series of 1,1,2,2,3,3,....

Hi all, I've an variable as page number (page) whose values increment by one each time. [Page numbering] But, now I need to customize this numbering to 1,1,2,2,3,3.. Can you suggest any formula for generate this kind of series? EDIT: (Answer) After playing with macros and VBA for some time I've figured out a way to generate this type...