formula

Math on batch (win)

Hello, i am developing a CMD batch kind of thing. Now, i want to do some math in it. This formula: (x+1)100:y or for guys who are not so good in math: x+1, answer times 100, answer devided by y. So in batch, x = %x%, and y = %y%. So, i know how to set the variables. Now, how can batch calculate this? (WINDOWS CMD) Do i need some...

How do you make mathematical equations readable and maintainable?

Given maths is not my strongest point I'm implementing a bezier curve for 3D animation. The formula is shown here, and as you can see it is quite nasty. In my programming I use descriptive names, and like to break complex lines down to smaller manageable ones. How is the best way to handle a scenario like this? Is it to ignore progra...

add extra column value to a column sum

Hi all, I have the following issue: I have a report that uses a Dataset as its datasource. The dataset has two tables, one would be the main table, say Employee, and the second table is EmployeePaycheck, so an employee can have several paychecks. I can compute the sum of a column in the second table, say paycheckValue, but what I can't s...

Team matchups for Dota Bot

I have a ghost++ bot that hosts games of Dota (a warcraft 3 map that is played 5 players versus 5 players) and I'm trying to come up with good formulas to balance the players going into a match based on their records (I have game history for several thousand games). I'm familear with some of the concepts required to match up players, li...

How to process formula by prolog?

If a+b+c=1 a^2+b^2+c^2=2 a^3+b^3+c^3=3 then a^4+b^4+c^4=? I've known the result is 25/6,but how to calculate it by prolog? I tried this but failed: [1] 5 ?- A+B+C=:=1,A**2+B**2+C**2=:=2,A**3+B**3+C**3=:=3. ERROR: Unhandled exception: =:=/2: Arguments are not sufficiently instantiated ...

Alpha blending a red, blue, and green image to produce an image tinted to any rgb value?

Basically, I have a context where I can't programatically tint an image, though I can change it's alpha value. With some experimentation, I've found that I can layer a red, blue, and green version of the image, with specific alpha values, to produce a wide range of colors. However, I am wondering if it's possible to achieve a true RGB ...

Write Hyperlink Formula to Excel with XMLWriter

Is there a way to write a hyperlink formula to an excel file using XMLWriter? In other words, I am trying to create an Excel file using XMLWriter and it works well except that my URL is merely a string and I want it to be a hyperlink. I tried writing =HYPERLINK(A1), for example, where A1 is the url string (thinking I could just hide th...

Need a formula: Extracting Years from Seconds Since January 1, 0001 12:00 AM

Input: # of seconds since January 1st, of Year 0001 Output: # of Full years during this time period I have developed an algorithm that I do not think is the optimal solution. I think there should be a solution that does not involve a loop. See Code Block 1 for the algorithm which A) Determines the quantity of days and B) Iteratively su...

outputting an array of links, with no overlapping!

When outputting links dynamically, I cannot determine the Y-Pos dynamically. It will work find if my links are single lined. link_txt.y = i*20; this will only work if the links are Single Lined. assuming they are 15px for height + 5 for spacing. As soon as they are 2 lines, they overlap. I've tried different methods but unable to figu...

Calculate scrollbar height according to amount of hidden contents

I'm creating a graphical scrollbar so I need to calculate the scrollbar height manually. You know how in most applications the scrollbar height changes based on how much there is to scroll? What is the formula for calculating the scrollbar height based on the amount of hidden contents? Is it logarithimic or exponential or just plainly b...

Creating a formula for calculating device "health" based on uptime/reboots

I have a few hundred network devices that check in to our server every 10 minutes. Each device has an embedded clock, counting the seconds and reporting elapsed seconds on every check in to the server. So, sample data set looks like CheckinTime Runtime 2010-01-01 02:15:00.000 101500 2010-01-01 02:25:00.000 102100 2010-...

Mapping a thread number to a (non sequential) position in an array

I would like to map a thread_id. This in C/CUDA but it is more an algebraic problem that I am trying to solve. So the mapping I am trying to achieve is along the lines: Threads 0-15: read value array[0] Threads 16-31: read value [3] Threads 32-47: read value [0] Threads 48-63: read value [3] Threads 64-79: read value array[6] Thread...

complex math with great circle formula

I have a from location (latitude, longitude) and to location (latitude, longitude). After calculating, it should show me what would be the nearest way to go from using a compass. The following is PHP code to do that, but its showing the wrong direction, I need little help on this. function GreatCircleDirection ($OrigLat, $DestLat, $Orig...

How do I fix this formula error?

I have this code in my program: (I included the cout statements for debugging purposes) cout << "b: " << b << "\na: " << a; constant[0] = (-b / (2 * a)); cout << "\nconstant: " << constant[0] << endl; The output I get is: b: -4 a: 3 constant: 0 Whereas I'm trying to make constant[0] equal to -(-4)/(2 * 3), or 0.6666... What am I do...

Is there a way to have math formulas look nice on a web page (as in LateX, for instance)

I wonder if there is a framework or something else to display Math formula on a web page. Other than using images of those formulas... ...

Hibernate: Many-to-one using Formula

Hi everybody, I hope someone can help me find an answer. I'm working with a legacy database and I can't change any of the preexisting tables, because other apps depend on them. I have three main existing tables: A,B,C. A has a column with reference to B(many to one relation). The problem is that it should have a relation to C not to B...

How to map a property with formula in NHibernate?

I have a class which I want to add a property with using formula attribute. Here is the mapping that I use in mapping file. <property name="CurrentUserVote" type="Climate.Domain.Vote, Climate.Domain" formula="(select v from Vote v where v.AchievementId=Id and (v.IP=:CurrentUserVoteFilter.CurrentUserIP))"></property> As you see, I wa...

Is it possible to disable a filter which is defined for a property in nhibernate?

I have a filter defined for a property in a mapping file like this; <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-lazy="false"> <class name="Climate.Domain.CompanyAchievement, Climate.Domain" discriminator-value="0" table="CompanyAchievement"> <id name="Id" column="Id" unsave...

Inserting value into Excel cell instead of formula

Hi, I have a VBA script that inserts long strings into Excel cells. In some cases, the string begins with a '='. It seems like Excel interprets this as a formula and I get an 'Out of Memory' error due to the memory limitations of formulas. How do I tell Excel that I am writing a value, not a formula? Currently, I am doing this: ws.Ran...

Extract information from conditional formula

I'd like to write an R function that accepts a formula as its first argument, similar to lm() or glm() and friends. In this case, it's a function that takes a data frame and writes out a file in SVMLight format, which has this general form: <line> .=. <target> <feature>:<value> <feature>:<value> ... <feature>:<value> # <info> <target> ...