How do we find a derivative of a function? There are many different ways to solve the derivative. Let’s use Newton difference quotient and evaluate derivative of \[ f(x)= x^2 \] Formula: $f^\prime(x)$ = $\lim_{h = 0}$ = \(\frac{f(x_0+h)-f(x)}{h}\) (1.0) h:range[slope] between 2 points x0 and x+h are data points at f(x0) and f(x+h). The red line is […]

### Variables and Datatypes

Datatype Table Datatype Size Range Int 4 Bytes -2147483648 … +2147483647 Boolean 1 bit true or false Byte 1 Byte(8 bit) -127…+127 short 2 bytes -32.768 – 32.767 long 8 Bytes -9,223..*10E18….+9,223*10E18 float 4 Bytes -+3.410E38 double 8 Bytes -+ 1.7e+038 char 2 Bytes 0 … 65,536 Example int number = 10; float num2 = 10f; // dont […]

### Arrays

Arrays An array is used to store more variables into 1 variable. It starts from int[] with square brackets +variable name and the definition of the datatype(in this case: new int[length] Example: int[] vector1D = new int[5]; // create 1D Array with the size of 5 int[][] vector2D = new int[5][5] // create 2D Array with the size […]

### Constructor java

Constructor is a block of code of another class.The main purpose of it is to instantiate an object of the other class.In general it’s possible to programm any code in one class, but it’s not really efficient way of programming.If your block of code is very big you, you will lose overview of your project. Syntax: Default constructor […]

### Modifier

In this tutorial, we will learn 2 types of most important modifiers „private “, “public“ and a simple class with overloaded methods. Every class and variable have a modifier, and class name (if not, it will be set by default and access is allowed only from the same package)Every class has a constructor (default: constructor without parameters). A […]

### Simpson’s Rule exercise

Approximate the integral [0 10] using Simpson’s Rule N = 10 Solution: Solution: 333,33 Download source code: Integral

### Taylor series exponential

Represent an exponential function as Taylor series. Iterate the function 10 times. Hint: Find the approximated Solution of x = 0.5 Solution: 1.6487213

### Decimal to binary converter

Today I show you how to write an application which converts decimal numbers to binary A binary number has only 2 values 1 and 0.Every device use these numbers to transport information or to transform current to digital numbers. Method 1: Output: 10000 Method2: In this method, we use a static method toBinaryString(value) from Integer Class int value= […]

### Loops

WHILE-LOOP “While loops” are used for repeating executions over specific count. The counter is only an aborting execution value. In general, a loop does not need a counter but in the practice, it’s not useful because of the amount of complexity O(n) and the application will run slow or will not work(high CPU utilization). There are exceptions like […]