Search Results

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

Page 11/42 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • optimization math computation (multiplication and summing)

    - by wiso
    Suppose you want to compute the sum of the square of the differences of items: $\sum_{i=1}^{N-1} (x_i - x_{i+1})^2$, the simplest code (the input is std::vector<double> xs, the ouput sum2) is: double sum2 = 0.; double prev = xs[0]; for (vector::const_iterator i = xs.begin() + 1; i != xs.end(); ++i) { sum2 += (prev - (*i)) * (prev - (*i)); // only 1 - with compiler optimization prev = (*i); } I hope that the compiler do the optimization in the comment above. If N is the length of xs you have N-1 multiplications and 2N-3 sums (sums means + or -). Now suppose you know this variable: sum = $x_1^2 + x_N^2 + 2 sum_{i=2}^{N-1} x_i^2$ Expanding the binomial square: $sum_i^{N-1} (x_i-x_{i+1})^2 = sum - 2\sum_{i=1}^{N-1} x_i x_{i+1}$ so the code becomes: double sum2 = 0.; double prev = xs[0]; for (vector::const_iterator i = xs.begin() + 1; i != xs.end(); ++i) { sum2 += (*i) * prev; prev = (*i); } sum2 = -sum2 * 2. + sum; Here I have N multiplications and N-1 additions. In my case N is about 100. Well, compiling with g++ -O2 I got no speed up (I try calling the inlined function 2M times), why?

    Read the article

  • Formula to format a cell to subtract one decimal place from another cell and have the calculated results displayed

    - by user242618
    I have a value in one cell that has four decimal places, in the cell below, I have the metric conversion formula. I want the cell below, with the metric conversion formula to display one less decimal place than the cell above. For example, if the English measurement is .#### (4 decimal places), I need the conversion cell to display .### (3 decimal places) and if the English measurement is .### (3 decimal places), I need the conversion cell to display .### ( decimal places), and so on. How can I do this?

    Read the article

  • Calculated Fields - Idiosyncracies

    - by PointsToShare
    © 2011 By: Dov Trietsch. All rights reserved Calculated Fields and some of their Idiosyncrasies Did you try to write a calculate field formula directly into the screen? Good Luck – You’ll need it! Calculated Fields are a sophisticated OOB feature of SharePoint, so you could think that they are best left to the end users – at least to the power users. But they reach their limits before the “Professionals “do, and the tough ones come back to us anyway. Back to business; the simpler the formula, the easier it is. Still, use your favorite editor to write it, then cut it and paste it to the ridiculously small window. What about complex formulae? Write them in steps! Here is a case in point and an idiosyncrasy or two. Our welders need to be certified and recertified every two years. Some of them are certifiable…., but I digress. To be certified you need to pass an eye exam, and two more tests – test A and test B. for each of those you have an expiry date. When renewed, each expiry date is advanced by two years from the date of renewal. My users wanted a visual clue so that when the supervisor looks at the list, she’ll have a KPI symbol telling her if anything expired (Red), is going to expire within the next 90 days (Yellow) or is not to be worried about (green). Not all the dates are filled and any blank date implies a complete lack of certification in the particular requirement. Obviously, I needed to figure the minimal of these 3 dates – a simple enough formula: =MIN([Date_EyeExam], {Date_TestA], [Date_TestB]). Aha! Here is idiosyncrasy #1. When one of the dates is a null, MIN(Date1, Date2) returns the non null date. Null is construed as “Far, far away”. The funny thing is that when you compare it to Today, the null is the lesser one. So a null it is less than today, but not when MIN is calculated. Now, to me the fact that the welder does not have an exam date, is synonymous with his exam being prehistoric, or at least past due. So here is what I did: Solution: Let’s set a blank date to 1/1/1800. How will we do that? Use the IF. IF([Field] rel relValue, TrueValue, FalseValue). rel is any relationship operator <, >, <=, >=, =, <>. If the field is related to the relValue as prescribed, the “IF” returns the TrueValue, otherwise it returns the FalseValue. Thus: =IF([SomeDate]="",1/1/1800,[SomeDate]) will return 1/1/1800 if the date is blank and the date itself if not. So, using this formula, if the welder missed an exam, the returned exam date will be far in the past. It would be nice if we could take such a formula and make it into a reusable function. Alas, here is a calculated field serious shortcoming: You cannot write subs and functions!! Aha, but we can use interim calculated fields! So let’s create 3 calculated fields as follows: 1: c_DateTestA as a calculated field of the date type, with the formula:  IF([Date_TestA]="",1/1/1800,[Date_TestA]) 2: c_DateTestB as a calculated field of the date type, with the formula:  IF([Date_TestB]="",1/1/1800,[Date_TestB]) 3: c_DateEyeExam as a calculated field of the date type, with the formula:  IF([Date_EyeExam]="",1/1/1800,[Date_EyeExam]) And now use these to get c_MinDate. This is again a calculated field of type date with the formula: MIN(c_DateTestA, cDateTestB, c_DateEyeExam) Note that I missed the square parentheses. In “properly named fields – where there are no embedded spaces, we don’t need the square parentheses. I actually strongly recommend using underscores in place of spaces in all the field names in your lists. Among other things, it makes using CAML much simpler. Now, we still need to apply the KPI to this minimal date. I am going to use the available KPI graphics that come with SharePoint and are always available in your 12 hive. "/_layouts/images/kpidefault-2.gif" is the Red KPI "/_layouts/images/kpidefault-1.gif" is the Yellow KPI "/_layouts/images/kpidefault-0.gif" is the Green KPI And here is the nested IF formula that will do the trick: =IF(c_MinDate<=Today,"/_layouts/images/kpidefault-2.gif", IF(cMinDate<Today+90,"/_layouts/images/kpidefault-1.gif","/_layouts/images/kpidefault-0.gif")) Nice! BUT when I tested, it did not work! This is Idiosyncrasy #2: A calculated field based on a calculated field based on a calculated field does not work. You have to stop at two levels! Back to the drawing board: We have to reduce by one level. How? We’ll eliminate the c_DateX items in the formula and replace them with the proper IF formulae. Notice that this needs to be done with precision. You are much better off in doing it in your favorite line editor, than inside the cramped space that SharePoint gives you. So here is the result: MIN(IF([Date_TestA]="",1/1/1800,[ Date_TestA]), IF([Date_TestB]="",1/1/1800,[ Date_TestB]), 1/1/1800), IF([Date_EyeExam]="",1/1/1800,[Date_EyeExam])) Note that I bolded the parentheses and painted them red. They have to match for this formula to work. Now we can leave the KPI formula as is and test again. This time with SUCCESS! Conclusion: build the inner functions first, and then embed them inside the outer formulae. Do this as long as necessary. Use your favorite line editor. Limit yourself to 2 levels. That’s all folks! Almost! As soon as I finished doing all of the above, my users added yet another level of complexity. They added another test, a test that must be passed, but never expires and asked for yet another KPI, this time in Black to denote that any test is not just past due, but altogether missing. I just finished this. Let’s hope it ends here! And OH, the formula  =IF(c_MinDate<=Today,"/_layouts/images/kpidefault-2.gif",IF(cMinDate<Today+90,"/_layouts/images/kpidefault-1.gif","/_layouts/images/kpidefault-0.gif")) Deals with “Today” and this is a subject deserving a discussion of its own!  That’s all folks?! (and this time I mean it)

    Read the article

  • How to deal with lots of brackets in a formula?

    - by wenlibin02
    Say, I have a formula like this (in LaTeX or Maple or other text system): Result: ((6*(k2+k3))*A123*k2*k3*(A12*A13*k2^2-2*A12*A13*k2*k3+A12*A13*k3^2-A123*k2^2-2*A123*k2*k3-A123*k3^2)*(exp(-k3*(k3^2*t-x)))^2+6*A12*(-k3+k2)*k2*k3*(A12*A13*k2^2-2*A12*A13*k2*k3+A12*A13*k3^2-A123*k2^2-2*A123*k2*k3-A123*k3^2)*exp(-k3*(k3^2*t-x)))*(exp(-k2*(k2^2*t-x)))^2+(-(6*(-k3+k2))*A13*k2*k3*(A12*A13*k2^2-2*A12*A13*k2*k3+A12*A13*k3^2-A123*k2^2-2*A123*k2*k3-A123*k3^2)*(exp(-k3*(k3^2*t-x)))^2-(6*(k2+k3))*k2*k3*(A12*A13*k2^2-2*A12*A13*k2*k3+A12*A13*k3^2-A123*k2^2-2*A123*k2*k3-A123*k3^2)*exp(-k3*(k3^2*t-x)))*exp(-k2*(k2^2*t-x)) Note: the above formula is only one part of the result of a maple calculation, I just can't break them up because there are so many many terms. Apparently, It's very hard to read. What I want to do is to fold the matched brackets level by level. If all the brackets are folded, I can find out clearly how many terms there are. Then I can analyze from the top level to the details of every term. But I just don't know how to realize that. Maybe there are some existed software which can visualize this kind of complex formula. Any idea? P.S. I use Linux system. The open source alternatives are better.

    Read the article

  • How to copy a cell's formatting using a formula?

    - by Alvin Lim
    For example, cell A1 contains the text "Hello World" which is in bold. In cell A2, I use the formula =A1. Therefore cell A2 now also contains "Hello World", but it is not in bold. How can I modify the formula to also copy the formatting (in this case, bold) of A1? A more complex example is strikethrough properties, i.e. A1 contains "Orange/Red". How do I show the same content in cell A2 dynamically, so that any changes made in A1 will update A2 as well?

    Read the article

  • Can I reactivate the cursor keys for modifying a cell reference in a formula?

    - by Jonas Heidelberg
    When I enter an Excel formula by hand avoiding the mouse, I can conveniently reference cells by using the arrow keys (-,<- etc.). For example, I can enter the formula =A2&B2 in cell C2 by entering =<-&<-<- The result looks like this: If I want to change from B2 to B3, I can just press the downward arrow on the keyboard at this time. How do I do the same thing later, after having left this cell (e.g. by pressing Enter)? In other words, how do I get the flashing dashed line back when re-entering a cell with F2?

    Read the article

  • RegExp to validate a formula (string/boolean/numeric expression)?

    - by JSteve
    I have used regExp quit a bit of times but still far from being an expert. This time I want to validate a formula (or math expression) by regExp. The difficult part here is to validate proper starting and ending parentheses with in the formula. I believe, there would be some sample on the web but I could not find it. Can somebody post a link for such example? or help me by some other means?

    Read the article

  • How to get levels for Fry Graph readability formula?

    - by Vic
    Hi, I'm working in an application (C#) that applies some readability formulas to a text, like Gunning-Fog, Precise SMOG, Flesh-Kincaid. Now, I need to implement the Fry-based Grade formula in my program, I understand the formula's logic, pretty much you take 3 100-words samples and calculate the average on sentences per 100-words and syllables per 100-words, and then, you use a graph to plot the values. Here is a more detailed explanation on how this formula works. I already have the averages, but I have no idea on how can I tell my program to "go check the graph and plot the values and give me a level." I don't have to show the graph to the user, I only have to show him the level. I was thinking that maybe I can have all the values in memory, divided into levels, for example: Level 1: values whose sentence average are between 10.0 and 25+, and whose syllables average are between 108 and 132. Level 2: values whose sentence average are between 7.7 and 10.0, and .... so on But the problem is that so far, the only place in which I have found the values that define a level, are in the graph itself, and they aren't too much accurate, so if I apply the approach commented above, trying to take the values from the graph, my level estimations would be too much imprecise, thus, the Fry-based Grade will not be accurate. So, maybe any of you knows about some place where I can find exact values for the different levels of the Fry-based Grade, or maybe any of you can help me think in a way to workaround this. Thanks

    Read the article

  • Is it a good idea to use a formula to balance a game's complexity, in order to keep players in constant flow?

    - by user1107412
    I read a lot about Flow theory and its applications to video games, and I got an idea sticking in my mind. If a number of weight values are applied to different parameters of a certain game level (i.e. the size of the level, the number of enemies, their overal strength, the variance in their behavior, etc), then it should be technically possible to find an overal score mechanism for each level in the game. If a constant ratio of complexity increase were empirically defined, for instance 1,3333, or say, the Golden Ratio, would it be a good idea to arrange the levels in such an order that the increase of overal complexity tends to increase that much? Has somebody tried it?

    Read the article

  • The Reality of Internet Marketing and SEO - A Successful Formula?

    Tired of getting all the hassles of hiring an SEO expert and spend thousands of dollars just to make your website go up in terms of rankings on search engines? For sure, all of us who are into online business or any kind of business that involves with having a website do feel a little bit frustrated especially when big money is involved and the results are close to nowhere.

    Read the article

  • How do I get the cell value from a formula in Excel using VBA?

    - by Simon
    I have a formula in a range of cells in a worksheet which evaluate to numerical values. How do I get the numerical values in VBA from a range passed into a function? Let's say the first 10 rows of column A in a worksheet contain rand() and I am passing that as an argument to my function... public Function X(data as Range) as double for c in data.Cells c.Value 'This is always Empty c.Value2 'This is always Empty c.Formula 'This contains RAND() next end Function I call the function from a cell... =X(a1:a10) How do I get at the cell value, e.g. 0.62933645? Excel 2003, VB6

    Read the article

  • Need a formula for calculating the tax portion of a total amount.

    - by pawz
    In Australia we have to advertise products with tax already added, so rather than say a product is $10 + $1 GST = $11, we normally work backwards and say "ok, total is $10, how much of that is GST ?" For example, for a $10 total, you do 10 * (1 /11) = 0.91, which is the tax component of the $10 total. My problem is I need calculate a formula for working out the taxable component when the tax rate is a variable. So far I've made this calculation although I'm not sure how correct an assertion it is: 10 * (1 / x) = 0.09 * (1 / y) where y = 10, x = 11 Basically i want to work out x on the left hand side when I know that the tax rate is 0.05 for example, which will give me a formula that I can use to calculate the taxable component of an total figure. I want a function into which I can plug in the total price and the tax rate, and get back the taxable component of the total price. I'd really appreciate the help with this as it really makes my head hurt ! :")

    Read the article

  • Assigned numbers to movie clip to plug in formula... not working

    - by Matthew MlgPro Harding
    So I am attempting to vertically evenly space these movie clips so I came up with a math formula involving n( the button number) but Its not working. var buttonArray:Array = [ side_banner.btn1, side_banner.btn2, side_banner.btn3, side_banner.btn4]; var buttonCount:uint = buttonArray.length; for (var i:uint=0; i< buttonCount; i++) { buttonArray[i].addEventListener(MouseEvent.CLICK, outputNumber); buttonArray[i].theTrigger = [i + 1]; } function outputNumber(e:MouseEvent):void { trace( e.target.theTrigger); buttonArray[i].y = (((stage.stageHeight - 400)/4)*(e.target.theTrigger)) - ((stage.stageHeight - 400)/4)/2 } But apparently each movie clip doesn't actually have a numerical value just a numeric name... how can I get the "n" btn number to use my formula? Thanks

    Read the article

  • Is there a 64-bit Windows 7 driver for a Logitech Wingman Formula Force wheel?

    - by Bob Cross
    I've used my Logitech Wingman Formula Force wheel for more years than I can remember (I definitely had it back when I was playing Viper Racing, though). Sadly, Logitech does not appear to support the wheel in any capacity, even as an analog input device. At this point, I'm looking for any sort of driver that will take input from the device. I don't care at all about the force feedback but, if it were available, I'd be happy to take it. The target operating system is Windows 7 64-bit. EDIT: Just in case I'm not clear above: I know where the standard driver download sites are and have tried them out. The problem is that Logitech has officially end-of-lifed this wheel so their latest software specifically does not support it. Sadly, their older software that does support it is 32-bit only so I'm out of luck on that front.

    Read the article

  • I will need a formula showing counts, totals and sub-totals for data set from different sheet

    - by Sapthagiri
    I am using MS2003 EXCEL. I have a cell in Sheet 1 with a color value and totals, with sub-totals. On sheet 2, I have a data set with 3 columns (colors, dress, type). On Sheet 1, I will need a tabulation showing Totals for Colors, with totals at sub-group of dress (shirt,pants) split by type totals (Full, Half, Tee) Below table represents my Data set in Sheet 2 Colors Make Dress Type -------------------------------- Red Arrow shirt full Red Levi shirt half blue Rugger Pant full yellow Wrangler shirt tee yellow Rugger Pant half yellow Arrow shirt tee yellow Wrangler Pant half Green Rugger Pant full Red Levi shirt tee blue Rugger Pant full blue Arrow shirt full blue Wrangler Pant half Green Levi shirt full I will need a formula showing counts, totals and sub-totals on Sheet 1 for data set from Sheet 2. Refer my table below which represent my expected data on Sheet 1, total Shirt Full Half Tees Pants Full Shorts Red 10 8 4 3 1 2 1 1 Blue Green Yellow Please note I am not looking for a Pivot table solution.

    Read the article

  • How can I make results of a formula values that can be filtered or use vlookup with Excel

    - by Burt
    I am having an issue in that I am using various formulas to move, split data, etc from various sources. The problem is when my final results post to the final destination that I want, I still need to either run advanced filters, or a vlookup with the results. I can’t do this because as an example if cell A1 shows a value of: A127 the actual cell content is: =RIGHT(A2,FIND(" ",A2&" ")-2) Everything I read said to copy and paste special values, but this doesn’t work for me as the idea is to have the formulas/macros run everything and eliminating cutting and pasting. In the case above I have a formula that pulls that info from a spreadsheet that is saved every week. Once it is pulled part of it is cut out in another column. I then need to run a vlookup on those results for data already contained on another tab.

    Read the article

  • Received a RAMPAGE IV FORMULA MOBO. Possible CPU Socket problems

    - by Tantan
    I recently received a Rampage IV Formula MOBO in a trade. From everything I read online this seems like a pretty nice piece of hardware. There's one thing I'm worried about though. It appears as though the socket where the CPU goes might have some bent/missing pins. I'm not exactly a computer expert and I wanted to know if this could be any sort of problem. I would post a picture but I apparently don't have enough rep for that... Also, if I did want to move my current rig onto the new MOBO would it even be worth it? MY CURRENT COMPUTER SPECS i3-3220 CPU 8GB DDR3 RAM GeForce GTX460 GPU With a Biostar MOBO!

    Read the article

  • How to determine if CNF formula is satisfiable in Scheme?

    - by JJBIRAN
    Program a SCHEME function sat that takes one argument, a CNF formula represented as above. If we had evaluated (define cnf '((a (not b) c) (a (not b) (not d)) (b d))) then evaluating (sat cnf) would return #t, whereas (sat '((a) (not a))) would return (). You should have following two functions to work: (define comp (lambda (lit) ; This function takes a literal as argument and returns the complement literal as the returning value. Examples: (comp 'a) = (not a), and (comp '(not b)) = b. (define consistent (lambda (lit path) This function takes a literal and a list of literals as arguments, and returns #t whenever the complement of the first argument is not a member of the list represented by the 2nd argument; () otherwise. . Now for the sat function. The real searching involves the list of clauses (the CNF formula) and the path that has currently been developed. The sat function should merely invoke the real "workhorse" function, which will have 2 arguments, the current path and the clause list. In the initial call, the current path is of course empty. Hints on sat. (Ignore these at your own risk!) (define sat (lambda (clauselist) ; invoke satpath (define satpath (lambda (path clauselist) ; just returns #t or () ; base cases: ; if we're out of clauses, what then? ; if there are no literals to choose in the 1st clause, what then? ; ; then in general: ; if the 1st literal in the 1st clause is consistent with the ; current path, and if << returns #t, ; then return #t. ; ; if the 1st literal didn't work, then search << ; the CNF formula in which the 1st clause doesn't have that literal Don't make this too hard. My program is a few functions averaging about 2-8 lines each. SCHEME is consise and elegant! The following expressions may help you to test your programs. All but cnf4 are satisfiable. By including them along with your function definitions, the functions themselves are automatically tested and results displayed when the file is loaded. (define cnf1 '((a b c) (c d) (e)) ) (define cnf2 '((a c) (c))) (define cnf3 '((d e) (a))) (define cnf4 '( (a b) (a (not b)) ((not a) b) ((not a) (not b)) ) ) (define cnf5 '((d a) (d b c) ((not a) (not d)) (e (not d)) ((not b)) ((not d) (not e)))) (define cnf6 '((d a) (d b c) ((not a) (not d) (not c)) (e (not c)) ((not b)) ((not d) (not e)))) (write-string "(sat cnf1) ") (write (sat cnf1)) (newline) (write-string "(sat cnf2) ") (write (sat cnf2)) (newline) (write-string "(sat cnf3) ") (write (sat cnf3)) (newline) (write-string "(sat cnf4) ") (write (sat cnf4)) (newline) (write-string "(sat cnf5) ") (write (sat cnf5)) (newline)

    Read the article

  • Crystal Reports - "A string is required here" formula error.

    - by George Mauer
    I have a command line utility that generates one simple crystal report. I recently updated the project from .NET 1.1 to .NET 3.5 using the Visual Studio 2008 migrator and am now getting an error that I had never received before. The problem is in the work_order formula which is as follows: stringVar nvl_ship_wrk_id := "0"; stringVar nvl_ship_wrk_seq := "0"; If Not IsNull({FeedBOLInput.ShipWrkId}) Then nvl_ship_wrk_id := {FeedBOLInput.ShipWrkId}; If Not IsNull({FeedBOLInput.ShipWrkSeq}) Then nvl_ship_wrk_seq := {FeedBOLInput.ShipWrkSeq}; nvl_ship_wrk_id & " - " & nvl_ship_wrk_seq; And the error is: - InnerException {"A string is required here. Error in File C:\\...\\temp_88c50533-02c6-4973-ae06-ed0ab1a603ac {0D5E96FB-038A-41C5-93A7-A9D199961377}.rpt: Error in formula <work_order>. 'stringVar nvl_ship_wrk_id := \"0\"; ' A string is required here."} System.Exception {System.Runtime.InteropServices.COMException} Does anyone have any idea what this can be? I'm out of clues. The dataset is coming in properly - and the error seems to point to a row which merely initializes a variable.

    Read the article

  • Control cell reference increment when dragging a forumula in Libre Office Calc (3.5)

    - by Chuck
    Using Libre Office Calc (3.5) and have a question. When copying a formula that references cells into multiple empty cells the default is to increment each cell reference by one column or row, depending on the direction that the formula is being drug. A formula '= 1 + A1' drug horizontally changes to '= 1 + B1' when pulled one cell to right and '=1 + A2' when pulled one cell down. Is there a way to control increase the increment of the referenced cell? Is is possible to have a formula '= 1 + A1' that effectively changes to '= 1 + A3' when drug down one cell, '= 1 + A5' when drug down two cells, etc? If it matters, I am trying to take a constantly updating master list of data that is organized by dates (Wednesdays and Saturdays) and create separate spread sheets for each day of the week that can be updated by only pulling down the formula into the next cell. My attempts at using the 'lookup' function, 'offset' function, and creating a sort column in Libre Office Calc are thwarted by my inability to figure out how to get around the single step increment when pulling a formula down into the next cell. Thanks

    Read the article

  • xbox thumbstick used to rotate sprite, basic formula makes it "stick" or feel "sticky" at 90 degree intervals! how do get smooth rotation?

    - by Hugh
    Context: C#, XNA game I am using a very basic formula to calculate what angle my sprite (spaceship for example) should be facing based on the xbox controller thumbstick ie. you use the thumbstick to rotate the ship! in my main update method: shuttleAngle = (float) Math.Atan2(newGamePadState.ThumbSticks.Right.X, newGamePadState.ThumbSticks.Right.Y); in my main draw method: spriteBatch.Draw(shuttle, shuttleCoords, sourceRectangle, Color.White, shuttleAngle, origin, 1.0f, SpriteEffects.None, 1); as you can see its quite simple, i take the current radians from the thumbstick and store it in a float "shuttleAngle" and then use this as the rotation angle (in radians) arguement for drawing the shuttle. For some reason when i rotate the sprint it feels sticky at 0, 90, 180 and 270 degrees angles, it wants to settle at those angles. its not giving me a smooth and natural rotation like i would feel in a game that uses a similar mechanic. PS: my xbox controller is fine!

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >