Search Results

Search found 1041 results on 42 pages for 'formula'.

Page 3/42 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • How would I code a complex formula parser manually?

    - by StormianRootSolver
    Hm, this is language - agnostic, I would prefer doing it in C# or F#, but I'm more interested this time in the question "how would that work anyway". What I want to accomplish ist: a) I want to LEARN it - it's about my ego this time, it's for a fun project where I want to show myself that I'm a really good at this stuff b) I know a tiny little bit about EBNF (although I don't know yet, how operator precedence works in EBNF - Irony.NET does it right, I checked the examples, but this is a bit ominous to me) c) My parser should be able to take this: 5 * (3 + (2 - 9 * (5 / 7)) + 9) for example and give me the right results d) To be quite frankly, this seems to be the biggest problem in writing a compiler or even an interpreter for me. I would have no problem generating even 64 bit assembler code (I CAN write assembler manually), but the formula parser... e) Another thought: even simple computers (like my old Sharp 1246S with only about 2kB of RAM) can do that... it can't be THAT hard, right? And even very, very old programming languages have formula evaluation... BASIC is from 1964 and they already could calculate the kind of formula I presented as an example f) A few ideas, a few inspirations would be really enough - I just have no clue how to do operator precedence and the parentheses - I DO, however, know that it involves an AST and that many people use a stack So, what do you think?

    Read the article

  • How to refer to enum values inside nhibernate formula mapping specification?

    - by mark
    Dear ladies and sirs. I have two entities types: RunContainer parent entity type Run child entity type Run has a property Status, which is of type RunStatus, like so: public enum RunStatus { Created, Starting, // ... } public class Run { public int ContainerId { get; private set; } // ... public RunStatus Status { get; private set; } } RunContainer has a calculated property ActiveRunCount, like so: public class RunContainer { public int Id { get; private set; } // ... public int ActiveRunCount { get; private set; } } In the mapping for the RunContainer.ActiveRunCount property, I use the formula specification like so: <property name="ActiveRunCount" formula="(select count(r.Id) from Run r where r.ContainerId = Id and r.Status = 1)"/> My problem is that I refer to the RunStatus enum values in the formula by their respective numeric value, rather than the appropriate symbolic name. Can anyone tell me how can I use the symbolic name instead? Thanks.

    Read the article

  • How do you write a "nested IF formula" in Excel?

    - by Mike
    I manually enter numbers on one cell according to text values in the cell adjacent to it. Is there a way to use the IF function to help me manage this? The text is automatically generated with a report but I put the numbers in manually in Excel. Example of my weekly boredom below: number Text in Cell 3 Order A 3 Order A 1 Order C 2 Order B 3 Order A 1 Order C 2 Order B 2 Order B HELP! My eyes and soul hurt each time I need to do this. Thanks Mike

    Read the article

  • How to write a "nested IF formula" in Excel?

    - by Mike
    I manually enter numbers on one cell according to text values in the cell adjacent to it. Is there a way to use the IF function to help me manage this? The text is automatically generated with a report but I put the numbers in manually in Excel. Example of my weekly boredom below: number Text in Cell 3 Order A 3 Order A 1 Order C 2 Order B 3 Order A 1 Order C 2 Order B 2 Order B HELP! My eyes and soul hurt each time I need to do this. Thanks Mike

    Read the article

  • Excel: What formula combines this data into one COUNT amount?

    - by Mike
    I have 30 colleagues who are answering questions over 3 time periods. Each has their own Excel workbook with the questions, and over the year they update it. I collate their worksheets into one master worksheet, but now need to combine their answers into a simple table. The questions, the time periods and then a COUNT of how many answered it. For example: I need a table that shows me how many people (not the persons name at this point) answered question 10 in time period 2. I can't use a database before someone mentions it ;). Many thanks Mike.

    Read the article

  • How to use the outcome of a formula as the value for Vlookup or another IF formula

    - by Steven
    Ok I will try to explain my issue effectively. I am making a GPA sheet in which the value out of 100 is computer in to a GPA value and then in to a letter. In cell N5 i have the value of all their grades (formula: =H3+H4+H5) Now in cell (j6) I have a formula which is giving them a number depending on the value calculated in N5 (Formula: =IF(AND(N5>=60,N5<=63.999),"2.0",IF(AND(N5>=64,N5<=66.999),"2.25",IF(AND(N5>=67,N5<=69.999),"2.4",IF(AND(N5>=70,N5<=73.999),"2.5",IF(AND(N5>=74,N5<=76.999),"2.75",IF(AND(N5>=77,N5<=79.999),"2.9",IF(AND(N5>=80,N5<=83.999),"3.0",IF(AND(N5>=84,N5<=86.999),"3.25",IF(AND(N5>=87,N5<=89.999),"3.4",IF(AND(N5>=90,N5<=93.999),"3.50",IF(AND(N5>=94,N5<=96.999),"3.75",IF(AND(N5>=97,N5<=100),"4",IF(AND(N5<=59.999),"0"))))))))))))) Still no problem... as the values I was looking for comes out (example 84.2 shows up as 3.25 as I wanted). However here comes the problem.... I have tried to use the outcome in J6 to do Vlookup or another if formula, however excel does not seem to recognize the value in J6. For example: =VLOOKUP(j6,B3:C15,2,FALSE)... this returns N/A however if I enter =VLOOKUP(3.25,B3:C15,2,FALSE) it gives me what im looking for. It seems that excel will not register the outcome of my formula as a number. What can I do please?

    Read the article

  • Getting data from closed files with concatenate formula

    - by Pav
    Each day a program is creating an excel file for me with some data for the current day. Like what is the price for products, how many people are available today and things like that. Based on all this I need to make some forecasts and workplace allocations for workers. The problem is, that I need to drag all this information manually all the time. So to make it automatic I placed the formula in cells like: ='c:\ABC\[ABC 29-01-14.xlsx]sheet'!a1 Everything works fine, but next day I have to change file name for "ABC 30-01-14" for each cell, what is the same as entering the data manually. So I used "concatenate" formula to change date according to today's date automatically. I used "indirect" formula to turn it in to a real formula, not text string, and realized that it is working only for open files, not closed. Is there any way to do this for closed files without VBA, because I don't know it, or with VBA but explained for an idiot.

    Read the article

  • Turn based battle and formula

    - by Mark Chapman
    I'm building a game called DVP(Digimon Virtual Pet), and in this game other than taking care of your digimon, You can also battle and breed them. I'm working on the battle system (making it first cause the actual pet system will be easy compared to the netplay, or 39DLL)but here is the problem I don't want it to be "too" simple or "too" complicated, but I do want to go by a certain formula. There are str, def, spd, and int. Strength: How hard the attacking digimon is hitting Defense: How much damage your digimon can defend when being attacked Speed: The chance of you missing the enemy Intelligence (battle knowledge): The chance of you hitting a critical hit or defending a critical hit. I can make a super simple turn based example, but I don't know how exactly to make the formulas for what I've explained above, any help?

    Read the article

  • Elastic Collision Formula in Java

    - by Shijima
    I'm trying to write a Java formula based on this tutorial: 2-D elastic collisions without Trigonometry. I am in the section "Elastic Collisions in 2 Dimensions". In step 1, it mentions "Next, find the unit vector of n, which we will call un. This is done by dividing by the magnitude of n". My below code represents the normal vector of 2 objects (I'm using a simple array to represent the normal vector), but I am not really sure what the tutorial means by dividing the magnitude of n to get the un. int[] normal = new int[2]; normal[0] = ball2.x - ball1.x; normal[1] = ball2.y - ball1.y; Can anyone please explain what un is, and how I can calculate it with my array in Java?

    Read the article

  • Is there a formula for this?

    - by Gortron
    TL/DR: Any way to work out if known numbers between a known start and ending figure should be positive or negative numbers? I am developing an application in PHP which can import and read PDFs. The PDFs are financial ones such as bank statements with records of transactions in and out of a bank account. I only have PDFs to work with, no other formats such as CSV unfortunately. I convert the PDF to HTML using pdftohtml and start parsing the data, the intended end result is an array of transactions. So far I have it working smoothly collecting dates, descriptions and balance. Converting the XML instead doesn't help. There are other pieces of transcriptional data such as debit or credit amounts. In the PDF, the credit amount is in one column and the debit amount is in another column so it is quite clear in the PDF. However, when converted to HTML, the formatting is lost and therefor I don't know if the amount was a credit or debit amount. So, my question is, given a starting balance and an ending balance and several known figures in between, is it possible for a programme to work out if those known figures in between are credit or debit amounts? I imagine there could potentially be several combinations of those known values to reach the ending balance so I'd like to apply a formula to return the correct credit/debit sequence only if its the only possible solution. If there are several ways of adding/subtracting the known values to reach the end balance, I can ask the user to look at it manually but I'd like to keep this to a minimum if possible. Possible to do, do you think? Thank you in advance for any help.

    Read the article

  • using an array in a custom formula in crystal reports xi

    - by Kim Sharpe
    I have a formula which is working; the formula uses an array. I tried to extract the formula to create a custom formula but now get an error in the syntax. I am wondering if the array is causing the problem as the error is on the line: last_element_current:=val(sc_array[1]) + 1; and the error is: the ) is missing and highlights the variable sc_array before the index [1].

    Read the article

  • Formula for popularity? (based on "like it", "comments", "views")

    - by paullb
    I have some pages on a website and I have to create an ordering based on "popularity"/"activity" The parameters that I have to use are: views to the page comments made on the page (there is a form at the bottom where uses can make comments) clicks made to the "like it" icon Are there any standards for what a formula for popularity would be? (if not opinions are good too) (initially I thought of views + 10*comments + 10*likeit)

    Read the article

  • Braces (syntax) highlighting in OpenOffice Math formula text editor

    - by Oleksandr Bolotov
    When you use OpenOffice Math, in upper part you see formula and formula text editor in lower part. Almost like this: %sigma = 2 %mu %epsilon + %lambda Tr(%epsilon)I So my questions are: How to replace OpenOffice Math's formula text editor with own text editor? ... or how to enable braces (syntax) highlighting in embedded editor? ... are there any extensions for anything like this? I need this because sometimes it's too much braces and stuff and it's hard to distinguish which braces match each other. Please do not suggest me to use MathType Mathematica (or anything) instead of OpenOffice Math (because I'm almost happy with it:)

    Read the article

  • NVelocity (or Velocity) as a stand-alone formula evaluator

    - by dana
    I am using NVelocity in my application to generate html emails. My application has an event-driven model, where saving and/or updating of objects causes these emails to be sent out. Each event can trigger zero, one or multiple multiple emails. I want to be able to configure which emails get sent out at run-time without having to modify code. I was thinking I could leverage the NVelocity #if() directive to do this. Here is my idea... Step 1) Prior to email sending, the administrator must configure a formula for NVelocity to evaluate. For example: $User.FirstName == "Jack" Step 2) When an object is saved or created, build an NVelocity template in memory based on the input formula. For example: String formula = GetFormulaFromDB(); // $User.FirstName == "Jack" String templ = "#if( " + formula + ") 1 #else 0 #end"; Step 3) Execute the NVelocity engine in memory against the template. Check the results to see if we have to send the email: String result = VelocityMerge(templ); // utility function if( result.Trim() == "1" ) { SendEmail(); } I know this is not exactly what NVelocity was intended to do, but I think it just might work :) One of the benefits of doing things this way is that the same syntax can be used for the formula as is used inside the template. Does anybody have any words of caution or suggestions? Is there a way to execute the #if() directive without jumping through hoops like I have above? Is there a recommended way to validate the formula syntax ahead of time? Thanks.

    Read the article

  • The Chinese SEO in the Internet SEO Formula

    Most ecommerce websites are designed in order to drive the Chinese internet users to the website thus delivering a good user experience that converts the users into customers. According to a statistical report on the internet development in China, conducted during the year 2009, the Chinese SEO of the ecommerce site plays an important role in determining the perception of the internet users towards internet as an information gateway and its impact on the user's behavior and attitude on internet trust.

    Read the article

  • formula for replicating glTexGen in opengl es 2.0 glsl

    - by visualjc
    I also posted this on the main StackExchange, but this seems like a better place, but for give me for the double post if it shows up twice. I have been trying for several hours to implement a GLSL replacement for glTexGen with GL_OBJECT_LINEAR. For OpenGL ES 2.0. In Ogl GLSL there is the gl_TextureMatrix that makes this easier, but thats not available on OpenGL ES 2.0 / OpenGL ES Shader Language 1.0 Several sites have mentioned that this should be "easy" to do in a GLSL vert shader. But I just can not get it to work. My hunch is that I'm not setting the planes up correctly, or I'm missing something in my understanding. I've pored over the web. But most sites are talking about projected textures, I'm just looking to create UV's based on planar projection. The models are being built in Maya, have 50k polygons and the modeler is using planer mapping, but Maya will not export the UV's. So I'm trying to figure this out. I've looked at the glTexGen manpage information: g = p1xo + p2yo + p3zo + p4wo What is g? Is g the value of s in the texture2d call? I've looked at the site: http://www.opengl.org/wiki/Mathematics_of_glTexGen Another size explains the same function: coord = P1*X + P2*Y + P3*Z + P4*W I don't get how coord (an UV vec2 in my mind) is equal to the dot product (a scalar value)? Same problem I had before with "g". What do I set the plane to be? In my opengl c++ 3.0 code, I set it to [0, 0, 1, 0] (basically unit z) and glTexGen works great. I'm still missing something. My vert shader looks basically like this: WVPMatrix = World View Project Matrix. POSITION is the model vertex position. varying vec4 kOutBaseTCoord; void main() { gl_Position = WVPMatrix * vec4(POSITION, 1.0); vec4 sPlane = vec4(1.0, 0.0, 0.0, 0.0); vec4 tPlane = vec4(0.0, 1.0, 0.0, 0.0); vec4 rPlane = vec4(0.0, 0.0, 0.0, 0.0); vec4 qPlane = vec4(0.0, 0.0, 0.0, 0.0); kOutBaseTCoord.s = dot(vec4(POSITION, 1.0), sPlane); kOutBaseTCoord.t = dot(vec4(POSITION, 1.0), tPlane); //kOutBaseTCoord.r = dot(vec4(POSITION, 1.0), rPlane); //kOutBaseTCoord.q = dot(vec4(POSITION, 1.0), qPlane); } The frag shader precision mediump float; uniform sampler2D BaseSampler; varying mediump vec4 kOutBaseTCoord; void main() { //gl_FragColor = vec4(kOutBaseTCoord.st, 0.0, 1.0); gl_FragColor = texture2D(BaseSampler, kOutBaseTCoord.st); } I've tried texture2DProj in frag shader Here are some of the other links I've looked up http://www.gamedev.net/topic/407961-texgen-not-working-with-glsl-with-fixed-pipeline-is-ok/ Thank you in advance.

    Read the article

  • multiple "ÏF" formula

    - by Karen
    I am trying to write an IF formula for an order form where a discount is applied depending on the amount of units ordered..... The discounts are: 0 to 24 units - 0 discount 24 to 59 units – 5% discount 60 to 95 units – 10% discount 96 to 131 units – 15% discount 132 to 263 units – 20% discount 264+ units - 30% discount the cell that i am taking the total from is J1028. I have no idea how to do IF formula's so desperately need some help. Thanks

    Read the article

  • Concatenate cells that change daily automatically?

    - by Harold
    I use concatenate to pull data together from different cells in my spreadsheet. Since my data changes daily, I want the formula to also change daily without having to manually input the new cell in the concatenate formula. I am looking for a way to do this but not sure how. Can anyone out there help me out please!? I appreciate the assistance in advance! Maybe this will help to explain what I need. I have a row of data from D4:AH4 that I insert daily based on the new day. When I use the concatenate and us the following formula: =CONCATENATE(TEXT('Raw Data'!B4,"m/d")," ",TEXT('Raw Data'!C4,"")," ", TEXT('Raw Data'!E4,"0.0%"))... E4 being the cell that changes daily where next day would be F4, G4, etc... All other parts of the formula will stay the same. I hope this helps! Thanks! :)

    Read the article

  • Ray Intersecting Plane Formula in C++/DirectX

    - by user4585
    I'm developing a picking system that will use rays that intersect volumes and I'm having trouble with ray intersection versus a plane. I was able to figure out spheres fairly easily, but planes are giving me trouble. I've tried to understand various sources and get hung up on some of the variables used within their explanations. Here is a snippet of my code: bool Picking() { D3DXVECTOR3 vec; D3DXVECTOR3 vRayDir; D3DXVECTOR3 vRayOrig; D3DXVECTOR3 vROO, vROD; // vect ray obj orig, vec ray obj dir D3DXMATRIX m; D3DXMATRIX mInverse; D3DXMATRIX worldMat; // Obtain project matrix D3DXMATRIX pMatProj = CDirectXRenderer::GetInstance()->Director()->Proj(); // Obtain mouse position D3DXVECTOR3 pos = CGUIManager::GetInstance()->GUIObjectList.front().pos; // Get window width & height float w = CDirectXRenderer::GetInstance()->GetWidth(); float h = CDirectXRenderer::GetInstance()->GetHeight(); // Transform vector from screen to 3D space vec.x = (((2.0f * pos.x) / w) - 1.0f) / pMatProj._11; vec.y = -(((2.0f * pos.y) / h) - 1.0f) / pMatProj._22; vec.z = 1.0f; // Create a view inverse matrix D3DXMatrixInverse(&m, NULL, &CDirectXRenderer::GetInstance()->Director()->View()); // Determine our ray's direction vRayDir.x = vec.x * m._11 + vec.y * m._21 + vec.z * m._31; vRayDir.y = vec.x * m._12 + vec.y * m._22 + vec.z * m._32; vRayDir.z = vec.x * m._13 + vec.y * m._23 + vec.z * m._33; // Determine our ray's origin vRayOrig.x = m._41; vRayOrig.y = m._42; vRayOrig.z = m._43; D3DXMatrixIdentity(&worldMat); //worldMat = aliveActors[0]->GetTrans(); D3DXMatrixInverse(&mInverse, NULL, &worldMat); D3DXVec3TransformCoord(&vROO, &vRayOrig, &mInverse); D3DXVec3TransformNormal(&vROD, &vRayDir, &mInverse); D3DXVec3Normalize(&vROD, &vROD); When using this code I'm able to detect a ray intersection via a sphere, but I have questions when determining an intersection via a plane. First off should I be using my vRayOrig & vRayDir variables for the plane intersection tests or should I be using the new vectors that are created for use in object space? When looking at a site like this for example: http://www.tar.hu/gamealgorithms/ch22lev1sec2.html I'm curious as to what D is in the equation AX + BY + CZ + D = 0 and how does it factor in to determining a plane intersection? Any help will be appreciated, thanks.

    Read the article

  • Equation / formula to determine an objects position on an ellipitcal path

    - by David Murphy
    I'm making a space game, as such I need objects to follow an elliptical path (orbit). I've worked out how to calculate all the important aspects of my orbits, the only remaining thing is how to have an object follow it. My Orbit class contains the major, minor (and by extension semi-major,semi-minor) lengths. The focii radius, area and circumference even. What is the equation to determine an objects x/y position (only need 2D) on an ellipse with a certain speed after a period of time. Basically, every frame I want to update the position based on the amount of elapsed time. I would like to have the speed along the path speed up and slow down according to the distance from the object it's orbiting, but not sure how to factor this in to the above given that at any point in time the speed has changed from it's previous speed. EDIT I can't answer my own question. But I found the question and answer is already on stackexchange: Kepler orbit : get position on the orbit over time

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >