# Homework 3

## Question 1:

One program was written for question 1. The user can choose the function and the method that will be used:

• Method: Secant or Newton-Raphson
• Function: x2-5, tanh(x) or tan(x)
• Koonin 1.5: x2-5
• Koonin 1.6: tanh(x) or tan(x)

Also, user have to choose the initial guess and minimum difference between two iterations.

### Question 1.5:

The positive root of x2-5 for two methods is the same, only the number of iterations is not the same but not differ much. It can be seen that number of iterations for Secant method is larger.

### Question 1.6:

Newton-Raphson method does not converge for initial guess greater than 1, because the derivative of tanh(x) is zero for this case. It can be seen from Figure 1. The secant method converges to the root for initial guess less than 1.5. In both methods, for valid input, the answer x=0 is resolved after few iterations. Figure 1: Graph of the function y=tanh(x).

## Question 2:

### Question 2.8:

The potential have been changed in the code to 4(x2+y2)2. I have adjusted the first coefficient to 4 in order to make sure that the trajectory will not go beyond the equilateral triangle of Henon-Heiles potential. The results for different initial conditions are presented in figures 2 and 3. By comparing these results with Figure 2.2 we can verify that the qualitative features don’t change if we use a different central potential.

Changing the initial parameter y changes the radius of toroid, when y is larger the innear radius of then toroid is smaller, py parameter does not affect much. Figure 2: Grapf for y=0.2 and py=0.02 Figure 3: Grapf for y=1 and py=0.02

### Question 2.9:

If the sign of the term y3 in the Henon-Heiles potential is changed, the Hamiltonian becomes integrable. It can be verified analytically by making a canonical transformation. This transformation give a separable potential in variable a and b. I change the sign in the code and tried to check effect of this with different initial conditions. Example is presented in the Figure 4. I also tried to use a different separable potential, harmonic . The result for harmonic potential can be seen in the Figure 5. Figure 4: Separable potential Figure 5: Harmonic potential

## Question 3:

I would like to describe the problem that I have seen in the course “Introduction to Mechatronics”.

### 1. Circuit with one nonlinear component.

Using Nodal Analysis, it is possible to find the voltage at every node in DC linear circuit. But it can’t be used if any nonlinear component, such as diode (Figure 1), appears in the circuit. Newton-Raphson method can help to solve this problem. Figure 1: Simple circuit with one nonlinear component, diode. It is possible to find V1 by writing the node equation at node 1. This is of the form f(V1)=0. We only need to find the root of this equation. Newton-Raphson (N-R) method can be used for solving this equation. This technique have been chosen because it is applicable for a system of nonlinear equations. ### 2. Non-linear network with many nodes

In the case of nonlinear network with many nodes we have to solve a system of nonlinear algebraic equations. Each function represents a node equation. Consider a system of n nonlinear equations in n unknowns. Initial guess can be made for the vector: Each equation is expanded using the Taylor series around this initial guess. The first iterate is found by solving n linear equations of the form given above. The system of these linear equations can be written as: The iterate j can be found in the same way from (j-1) iterate. There is no guarantee that the solution always converge so the loop must be terminated upon a maximum number of iterations or when two successive iterations are close as defined by some criterion.

One of possible ways to check the solution is another initial guess that must to converge to the same value. Also it is possible to solve the problem by changing the step size. If function changes very rapidly for small change in x we will have convergence problem. It can be solved by changing the step size. I will write the code in C or Matlab (Matlab is very useful for system of linear equations).