Percentages of Bitcoin with PHP. Are my calculations correct?

Need to determine the percentages of bitcoin in PHP. I am using this function:

$ bitcoin_price = "0.01096616";
$ percentage = (3.9 / 100) * $ bitcoin_price;
echo $ percentage;

My result is 0.00042768024 of 3.9%

Is this correct?

java – Object oriented approach for calculations

I need to determine the average miles per hour for a trip and an object that contains a list of trips. I'm thinking of two approaches. First, have a MphCalculator class that would inject into each class as

public class MphCalculator {

public BigDecimal calculaMph (int durationSeconds, BigDecimal miles) {
// calculate the speed
}

}

The second approach would be that each object has its own reference to a MphCalculator class as

public class speed calculator {

end int durationSeconds;
Final BigDecimal miles;

Public SpeedCalculator (int durationSeconds, BigDecimal miles) {
this.durationSeconds = durationSeconds;
this.miles = miles;
}


public BigDecimal calculaMph () {
// calculate and store speed
}

}

The second approach for me seems more object-oriented, but it also seems that I may be creating unnecessary objects. If someone could offer some advantages and disadvantages, it would be very useful! Also, this is my first question, so if you could improve this publication, let me know.

Total salary calculations

https://docs.google.com/spreadsheets/d/13HdNN_qa9rhLFyMe0N9I9EusmBudi_dcdBkc6UeLHMM/edit#gid=878850570

I am trying to complete the Normal Payment, but the formula does not multiply the Regular Hours by the Normal Rate, therefore, I get a R6.33 sum instead of R152.00

  1. I would appreciate the help with a formula to calculate the currency / price according to the duration or time.

  2. Also, how to automatically add other cells? example – this formula = SUM (H2: H * 1.5) Will it be applied every time a new entry is made in the column?

mathematics – Help for Linear Dilation calculations in Python

Hi. This is my first entry in the StackOverflow, so I apologize if I ever made a mistake.

Staff, can you help me? I am trying to develop a code in Python that can calculate the Linear Dilation of some material informed via function.
But I have a problem when it comes to cutting the alpha in the equation. In physics, an example of alpha for linear dilation calculations is (10 * 1,2 ^ -5) ° C ^ -1. But if I put this calculation in a python variable, when trying to print, it shows this as a calculation and not as a value.

An example:

Linear dilatation of an iron plate that the (delta) T (final temperature minus the initial temperature) will be 30m, the size of the plate will be 100m and the alpha will be (10 * 1,2 ^ -5) ° C ^ -1

Delta L = 100 x (10 * 1,2 ^ -5) x 30
Delta L = 3600 ^ -5m ° C ^ -1
(I'm not continuing to avoid some tithe)

This is the result of the equation 3600 ^ -5 m ° C ^ -1

If I wanted to reproduce this same calculation in python and make the printed result the same, how should I do it?

math – Why can not my programs do arithmetic calculations correctly?

Your programs can do arithmetic calculations correctly.

For example, with the bc program:

jose @ luthien ~ $ bc
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty '.
0.1 + 0.1
.two
0.1 + 0.2
.3
10 * 0.67
6.70
10 * 0.68
6.80
10 * 0.69
6.90

With Java:

testmatematicas package;
import java.math.BigDecimal;
public class TestMatematicas {
    public static void main (String[] args) {
        BigDecimal zeroPoint One = new BigDecimal ("0.1");
        BigDecimal sum = zeroPointOne.add (zeroPointOne);
        System.out.println (sum);
        BigDecimal zeroPointDos = new BigDecimal ("0.2");
        sum = zeroPointOne.add (zeroPointTwo);
        System.out.println (sum);
        BigDecimal ten = new BigDecimal ("10");
        BigDecimal zeroPointSesentaYouth = new BigDecimal ("0.67");
        BigDecimal multiplication = ten.multiply (zeroPointSesentaYouth);
        System.out.println (multiplication);
        BigDecimal zeroPointSesentaYOcho = new BigDecimal ("0.68");
        multiplication = ten.multiply (zeroPointSesentaYOcho);
        System.out.println (multiplication);
        BigDecimal zeroStepNine and Nine = new BigDecimal ("0.69");
        multiplication = ten.multiply (zeroPointSesentaYNueve);
        System.out.println (multiplication);
    }
}

The output is:

0.2
0.3
6.70
6.80
6.90

And, in fact, in your example the computer is not calculating the sum incorrectly. What the computer is doing is what it always does: Do what you have told him, STRICTLY, which does not have to be what you want him to do.

When you do 0.1 + 0.2 it seems that you ask him to add 0.1 to 0.2, whose result should be 0.3
But it's not like that. What you have actually told the computer to do is:
Interpret and execute the expression contained in the string "0.1 + 0.2"

Which entails the following actions:

  • Lexicographical analysis that divides the chain into 3 symbols (tokens): 0.1 , + Y 0.2
  • Syntactic analysis that, for example (can be of many forms), creates a structure of syntactic tree:
    syntactic tree

  • Semantic analysis that converts 0.1 to the value closest that is representable with the type of data chosen, in this case the implicit one. And the same with 0.2. Here is a source of error. The program will not handle the 0.1 value but the closest one that is representable in the chosen data type, which in javascript is double precision as specified in standard IEEE 754. And in that 0.1 format it is not possible to represent it exactly, with which there is a small error.

  • Execution. That adds the two values ​​and converts the result to the nearest one that is representable. This is another source of errors.
  • Print. Print a visual representation of the sum value obtained. It may happen that the result is correct (for example 0.125 + 0.125 = 0.25) but that fewer decimal places (0.2) are printed for the chosen printing format. In this case the computer has calculated the exact solution but has shown an approximation. And it can also happen that the result is inaccurate (for example 0.1 + 0.2 = 0.30000000000000004) but that by the chosen printing format, decimals are omitted, giving the appearance of an exact result (.3) even though the sum value stored in the computer is slightly inaccurate

It is possible to make exact calculations on a computer. There are specific programs and languages ​​for it.
In general-purpose programming languages, such as C ++, Java or Javascript, approximate calculations are made by default, for performance reasons and because it is sufficient for multiple applications. In these languages ​​it is also possible to make exact calculations but you have to use the appropriate libraries and / or language elements.

calculations: what is the formula to calculate the aperture (diaphragm in French)?

The equation is:

        f-number² illuminance × ISO value
───────────── = ───────────────────────
incident time exposure light meter
in seconds constant calibration

OR N² = E * S * t / C, as you have summarized it with N as opening to the left. Note that the calibration constant ("C") corresponds to your subway, not to the camera, and generally depends on the shape of the light receiving surface (flat or dome).

Calculate the aperture and the exposure time you need from this, and then adjust these for your neutral density filter and the desired exposure compensation. Each change of 1 unit in the EV is a stop, and you can adjust the exposure time or aperture (or, in this case, ISO) accordingly.

Or to put it simply: Add the EV value of the neutral density filter (as a positive number of stops) and your EV value of the desired exposure correction. If the result is positive, extend the opening at one stop for each EV correction. If the result is negative, reduce the opening by that amount.

If you want to put this in formula form, it would be:

N = √ (E × S × t / C) / √ (2 ^ (EV compensation + filter stops ND))

Of course, there are other ways to organize the EV compensation and the ND filter values, but this representation matches the way a photographer thinks about it: setting the basic exposure parameters and then calculating the compensation. (You could change the equation so that the EV compensation and the ND filter stop values ​​are in the first √, and probably do I want to do that as an optimization.)

Frequently the range of adjustable openings does not provide the flexibility that would be needed for this in the real world. Your lens probably will not f / 64 or f / 1.0. In this case, you will have to adjust one of the other parameters, of course.

It can help to consider this visualization:

enter the description of the image here

The adjustable exposure parameters in the camera are the axes. opening (number f), shutter speedY I ASI. The objective exposure is the volume of the cube.

Numerically in the basic formula, this volume is determined by the illuminance Y calibration constant values. (The "calibration constant" is a value selected to provide a nominally correct general exposure for a given scene illumination).

Exposure compensation is basically you as a human being who overrides that measure and increases or decreases the target volume. In the same way, the addition of an ND filter reduces the volume by half (for each stop).

Programming – Another use of Resolver for other calculations.

I probably missed an already published question since this topic seems common, but I looked at several, for example. Using the result of solving in other calculations
and I'm a bit stuck I did not understand the use of Prefix in this (which only had 1 solution anyway): use of Solve results for additional calculations

If I have something like

eq1 = x ^ 2 - 3 * and ^ 2 + 3
sun = Reduce[eq1 == 0, y, Complexes]
Sun[[1]][[2]]eq2[i_] = 100 + (and /. Y -> sun[[i]][[2]])

Part :: pkspec1: the expression i can not be used as a part specification.

I made sure not to use SetDelayed, and I know I can do things like,

100 + (and /. Y -> sun[[1]][[2]])

where 100 + and It's a new function, but the one it is chosen by the script itself automatically and can not be "encoded".

What kind of methodology can be used when there are functions called functions that call … etc, which ultimately depend on the automatic choice of a set of solutions?

P.S.

I also tried to name a set of rules, but I can not keep the left side unchecked (like a & # 39; in Lisp),

solSet = Table[Unevaluated[y] -> and /. and -> sun[[i]][[2]], {i, 1, 2}]

Differential equations: How can I use the results returned by DSolve in other calculations?

What do you mean exactly with handle?

However, here are some common examples that users ask about the additional use of DSolve exit.

Eq = v & # 39;

soln = v

$ frac {(E ^ {(- ((k t) / m))} (-1 + E ^ {((k t) / m))} g m)} {k} $

The solution is assigned to soln, now you can use it for future manipulations. For example,

Table[{t, soln /. {g -> 9.8, k -> 1, m -> 1}}, {t, 0, 10}]

or

Plot[soln /. {g -> 9.8, k -> 1, m -> 1}, {t, 0, 10}]

How to perform certain calculations in Google Sheets?

I'm 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 achieved the do column working properly. Now I just need help with re Y my.

1 in re (I have added examples) I would like you to calculate the difference between the current and previous weight input with a formula that can be completed automatically (taking into account that the entries are usually separated by sporadic empty cells). So each number in do minus the entrance above it.

2: Next in my I would like to show the average every 7 days that will change depending on my loss rate of re. He added some manually calculated numbers as an example. Quite sure that I have miscalculated it though. Arg! I should have stayed at school 🙂

This is the first time I use sheets, so I am an absolute beginner. I did not even use Excel. I tried to find a solution on Google, but I could not find anything. I think the problem is that I do not know exactly what to look for.

Let me know if you need more information.

Set associative cache calculations

I found the following problem:

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

I tried to solve it in the following way:

  • 4 lines per game
  • Word size of main memory: $ 32 $ bits $ = 2 ^ 4 $
  • Word size of the cache: $ 16 $ bits $ = 2 ^ 2 $
  • Size of main memory: $ 4 times 2 ^ {10} = 2 ^ {12} $ words of $ 32 $ bits $ = 2 ^ {13} $ words of $ 16 $ bits
  • The cache must adapt to the main memory. So the size of the cache = size of the main memory $ = 2 ^ {13} $ words of $ 16 $ bits
  • Line size $ = $ two 16-bit words $ rightarrow $ Word displacement $ = 1 $ bits
  • Associative set of four directions. $ rightarrow 4 = 2 ^ 2 $ lines per set
  • Set size $ = 2 ^ 2 text {lines} times 2 text {words per line} = 2 ^ 3 $ words of 16 bits in size
  • Number of sets $ = 2 ^ {13} / 2 ^ 3 = 2 ^ {10} $
  • Set the index size $ = 10 $ bits
  • Label size = Size of the address of 24 bits $ – $ 10 bit set index $ – $ 1 bit word shift = 13 bit

Doubts

  1. I am surprised how it is said that the 16-bit processor generates 24-bit addresses. it's possible? I never encountered such problem.
  2. How can the cache and main memory have different word sizes? Here, the word size of the cache is 16 bits and the word size of the main memory is 32 bits.
  3. Taking into account the unusual scenarios (assumptions I made) explained in points 1 and 2 above, am I correct with the previous calculations?
  4. The answer only gives a diagram (without explanation) that says 1 bit per word, 1 bit per byte address and 12 bits per label. So, am I wrong?

    enter the description of the image here