Are my AnyDice calculations for the Old World Of Darkness correct?

Here is the average amount of successes you can get from a given dicepool (left column) and given difficulty (upper row). Are the forumulas correct?

Here is my program on AnyDice.com.

Are there any mistakes in it? The program is well-commented, so it should be easy to understand things.

I am writing an article about oWoD (more specifically, V20) odds, usefullness of some skills, and if some of the calculations are incorrect, the whole article will be useless. So please, help me. 🙂

P.S. I should credit the developer of for answering my questions about syntaxis of AnyDice for almost 2 hours, and also helping me with the concept of one function (even though I rewrote things almost entirely :3).

Google Sheets: Calculations

I’m trying to make a simple calculator in google sheets with checkboxes for certain values. For simplicity I’ll refer to these Checkboxes as A and B. What I would like to have is the user selects A, B, either, or both and have that output a value. However, I want the user to be able to unselect these boxes, but the total from the the first value is unaffected.

Right now I have A=5 and B=10. I can check both, and get 15 in a separate cell. I can then subtract that cell from the total. However, when I uncheck the boxes, the values, including the total reset. Is there a function I can use that will total only when commanded, and result is independent of if the boxes are checked or not?

SQL Database structure to store calculations

I am in the process of designing a database structure to store some calculation information.

Information about the problem:

  • Each “calculation” is a collection of scripts allowing to calculate value, target, low limit and high limit. All of those are optional.

  • A calculation script is a string, that will be parsed by the client app. Example: 50 + 9

I have tried to follow the principles of normalization, as I understood those, and I came up with:

CREATE TABLE CalculationScript( ScriptId int NOT NULL PRIMARY KEY, Script VARCHAR(8000) NOT NULL );  CREATE TABLE Calculation( CalculationId int NOT NULL PRIMARY KEY, Name nvarchar(100) NOT NULL );  CREATE TABLE ValueScript( CalculationId int FOREIGN KEY REFERENCES Calculation(CalculationId), ScriptId int FOREIGN KEY REFERENCES CalculationScript(ScriptId) );  CREATE TABLE TargetScript( CalculationId int FOREIGN KEY REFERENCES Calculation(CalculationId), ScriptId int FOREIGN KEY REFERENCES CalculationScript(ScriptId) );  CREATE TABLE LowLimitScript( CalculationId int FOREIGN KEY REFERENCES Calculation(CalculationId), ScriptId int FOREIGN KEY REFERENCES CalculationScript(ScriptId) );  CREATE TABLE HighLimitScript( CalculationId int FOREIGN KEY REFERENCES Calculation(CalculationId), ScriptId int FOREIGN KEY REFERENCES CalculationScript(ScriptId) ); 

Before moving forward with it, I would like some feedback on this structure, and in particular, is it overkill to create so many tables for such a simple problem?

Using multiple IF and OR statements with calculations

I’m trying to calculate prices for items that have various costs. Depending on what that cost is determined its multiplier. I’m hoping I can create a formula in a spreadsheet to streamline my process. Below is my logic. Everything is calculating correctly up until the third if statement. I can’t figure out why

=IF(AV2<=5,AV2*4,  IF(OR(AV2>=5.01,AV2<=11),AV2*3.2,  IF(OR(AV2>=11.01,AV2<=15.5),AV2*2.8,  IF(OR(AV2>=15.51,AV2<=20.5),AV2*2.7,  IF(AV2>=20.51,AV2*2.3)))))

How to perform certain calculations in Google Sheets?

Just trying to create a simple sheet to track my weight loss. Here is a link to my sheet so far so you can see what I’m talking about. Weight Loss Sheet

So far I have gotten the C column working properly. Now I just need help with D and E.

1: In D (I have added examples) I would like it to calculate the difference between the current and previous weight entry with a formula that can auto-fill (keeping in mind that entries are often separated by sporadic empty cells). So each number in C minus the entry above it.

2: Next in E would like it to show the average every 7 days that will change depending on my rate of loss from D. Added a few manually calculated numbers as an example. Pretty sure I have calculated it wrong though. Arg! Should have stayed in school 🙂

This is my very first time using sheets so I am an absolute beginner. Never even used Excel. I have tried googling for a solution but I couldn’t find anything. I think the problem is I don’t know exactly what to search for.

Let me know if you need more info.

Set associative cache calculations

I came across following problem:

Given the following specifications for an external cache memory: four-way set associative; line size of two 16-bit words; able to accommodate a total of 4K 32-bit words from main memory; used with a 16-bit processor that issues 24-bit addresses. Design the cache structure with all pertinent information and show how it interprets the processor’s addresses.

I tried solving it as follows:

  • 4 lines per set
  • Main memory word size: $ 32$ bits $ =2^4$
  • Cache memory word size: $ 16$ bits $ =2^2$
  • Main memory size: $ 4\times 2^{10}=2^{12}$ words of $ 32$ bits $ =2^{13}$ words of $ 16$ bits
  • Cache memory needs to accomodate full main memory. So Cache memory size = main memory size $ =2^{13}$ words of $ 16$ bits
  • Line size $ =$ two 16 bit words $ \rightarrow $ Word offset $ = 1$ bits
  • Four way set associative $ \rightarrow 4=2^2$ lines per set
  • Set size $ = 2^2\text{ lines}\times 2 \text{ words per line}= 2^3$ words of 16 bit size
  • Number of sets $ =2^{13}/2^3=2^{10}$
  • Set index size $ = 10$ bits
  • Tag size = 24 bit address size $ -$ 10 bit set index $ -$ 1 bit word offset = 13 bit

Doubts

  1. I am surprised how 16 bit processor is said to generate 24 bit addresses. Is this possible? I never came across such problem.
  2. How cache memory and main memory can have different word size? Here, cache memory word size is 16 bits and main memory word size is 32 bits.
  3. Considering unusual scenarios (assumptions I made) explained in point 1 and 2 above, am I correct with above calculations?
  4. The answer gives only diagram (no explanation) saying 1 bit for word, 1 bit for byte addressing and 12 bits for tag. So am I wrong?

    enter image description here

Javascript Loops – having trouble with calculations

import java.util.Scanner; import javax.swing.JOptionPane; public class Homework_Four {         static Scanner  scan = new Scanner(System.in); //declaring variables         private static String name,jOptionInput;         private static int menuChoice,quantity,totalQuantity=0;         private static double price=0,saleTax=0,totalAmount;                       public static void main(String[] args) {         javax.swing.SwingUtilities.invokeLater(new Runnable() {         public void run(){...
PHP:

Javascript Loops – having trouble with calculations

How do you place a quote inside a string on Cognito Forms calculations?

Cognito form allows for text calculation. But how do you put the ” character inside a string that is defined with quotes?

This is a very common problem in all programming languages, typically, there will be something called an escape character that is placed before the quote character so that it can be in the sting.

Here is an example of an escape character being used.

"This is a string with a \" character" 

How is this accomplished in Cognito Forms calculations?