<jupyter_start><jupyter_text>Homework 6 <NAME> 3/19/2016  xy_ODEThis section solves a differential equation by the Euler's Forward method over the interval 0 to 4 and then plots the solutions for 5, 17, and 401 fixed points (blue, red, and green respectively) as well as the analytic solution (black). As is readily apparent, 5, and even 17 fixed points are nowhere near sufficient in order to produce the required accuracy. 401 points is a good approximation, but more points would still be required for exact correspondence. That's why this method isn't great, especially in the days before computers. Can you picture Euler going through the process of calculating 401 points? I can. Mathematicians are odd like that.<jupyter_code>p1.graph()<jupyter_output><empty_output><jupyter_text>We can also use sympy to solve for the differential equation numerically, as demonstrated below. Note that the value C1 would depend on the value of epsilon given for the equation.<jupyter_code>p1.symbolic_solver()<jupyter_output>f(x) == sqrt(C1 + x) + 1<jupyter_text>unstable_ODEThe crux of this implementation is that for the differential equation y' = Cy, the separation yields a recursive relationship of multiplication by a constant value, the likes of which always renderes itself such that the value of y_k is always equal to (1 + Cdx)^k * y_0, as this implements this simple multiplication by a constant which the problem calls for.If the value of Cdx is such that it is less than -1 but greater than -2, the multiplied factor will be between 0 and -1, and will thus oscillate and decrease. This is simply a geometric series. Here, we have set C to -1, and thus Delta t values between 1 and 2 exclusive will produce such behavior. Delta t values greater than 2 will oscillate in sign, but as the absolute value of the argument they create is greater than 1, they will grow with each time steps, without bound.<jupyter_code>p2.tabler()<jupyter_output>Oscillation Demonstration First 4 Values

   Delta t    Value 1    Value 2    Value 3    Value 4

      1.22   1.000000  -0.222222   0.049383  -0.010974
      1.57   1.000000  -0.571429   0.326531  -0.186589
      1.83   1.000000  -0.833333   0.694444  -0.578704
      2.75   1.000000  -1.750000   3.062500  -5.359375<jupyter_text>Notice how as the other values go decreasing in magnitude, the Delta t = 2.75 case is obviously in it to win it big.Similarly to the last example on xy_ODE, we can also solve this symbolically using sympy.<jupyter_code>p2.symbolic_solver()<jupyter_output>f(x) == C1*exp(-x)
{'fraction_non_alphanumeric': 0.05688505296194586, 'fraction_numerical': 0.0690466849744998, 'mean_word_length': 4.151515151515151, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '503843', 'license': 'MIT', 'n_tokens_mistral': 849, 'n_tokens_neox': 722, 'n_words': 366, 'path': 'Homework_6.ipynb', 'repo_name': 'chapman-phys227-2016s/hw-6-patti102', 'size': '2555'}