<jupyter_start><jupyter_text>Exercise 3 task 2<jupyter_code>import cmath
#main equation x_dot=alpha-x**2
#node x_node=(+)(-)sqrt(alpha)
alpha = np.arange(-1.0, 1.0, 0.01)
alpha=np.array(alpha)
list_n=[]
list_p=[]
for i in alpha:
    x_node_plus=cmath.sqrt(i)
    x_node_minus=-cmath.sqrt(i)
    list_n.append(x_node_minus)
    list_p.append(x_node_plus)
plt.plot(alpha,list_p,color='blue',label="when x0=sqrt(a)")
plt.plot(alpha,list_n,color='red',label="when x0=-sqrt(a)")
plt.legend()
plt.show()
#main equation x_dot=alpha-2*x**2-3
#node x_node=(+)(-)sqrt((alpha-3)/2)
alpha = np.arange(-1.0, 4.0, 0.01)
alpha=np.array(alpha)
list_n=[]
list_p=[]
for i in alpha:
    x_node_plus=cmath.sqrt((i-3)/2)
    x_node_minus=-cmath.sqrt((i-3)/2)
    list_n.append(x_node_minus)
    list_p.append(x_node_plus)
plt.plot(alpha,list_p,color='blue',label="when x0=sqrt((a-3)/2)")
plt.plot(alpha,list_n,color='red',label="when x0=-sqrt((a-3)/2)")
plt.legend()
plt.show()<jupyter_output>C:\Users\Afaq\Anaconda3\lib\site-packages\numpy\core\numeric.py:538: ComplexWarning: Casting complex values to real discards the imaginary part
  return array(a, dtype, copy=False, order=order)
C:\Users\Afaq\Anaconda3\lib\site-packages\numpy\core\numeric.py:538: ComplexWarning: Casting complex values to real discards the imaginary part
  return array(a, dtype, copy=False, order=order)<jupyter_text>Behaviour at alpha=0.0<jupyter_code>w = 3
alpha=0.0
Y, X = np.mgrid[-w:w:25j, -w:w:25j]
U = alpha-X**2
V = -Y
seed_points = np.array([[3,0,3,0,-1,-1,-1], [-3,-3,3,3,-3,0,3]])

fig = plt.figure(figsize=(15, 15))
gs = gridspec.GridSpec(nrows=3, ncols=2, height_ratios=[1, 1, 2])

#  Varying density along a streamline
ax0 = fig.add_subplot(gs[0, 0])
ax0.streamplot(X, Y, U, V, density=[0.5, 1])
ax0.streamplot(X, Y, U, V, color='orange', linewidth=2,
                         cmap='autumn', start_points=seed_points.T)
plt.plot(0,0,'rx') 
ax0.set_title('alpha=0')
w = 3
alpha=-1.0
Y, X = np.mgrid[-w:w:25j, -w:w:25j]
U = alpha-X**2
V = -Y
seed_points = np.array([[3,0,3,0,-1,-1,-1], [-3,-3,3,3,-3,0,3]])

fig = plt.figure(figsize=(15, 15))
gs = gridspec.GridSpec(nrows=3, ncols=2, height_ratios=[1, 1, 2])

#  Varying density along a streamline
ax0 = fig.add_subplot(gs[0, 0])
ax0.streamplot(X, Y, U, V, density=[0.5, 1])
ax0.streamplot(X, Y, U, V, color='orange', linewidth=2,
                         cmap='autumn', start_points=seed_points.T)
#plt.plot(0,0,'rx') 
ax0.set_title('alpha=-1.0')
w = 3
alpha=-1.0
Y, X = np.mgrid[-w:w:25j, -w:w:25j]
U = alpha-2*X**2-3
V = -Y
seed_points = np.array([[3,0,3,0,-1,-1,-1], [-3,-3,3,3,-3,0,3]])

fig = plt.figure(figsize=(15, 15))
gs = gridspec.GridSpec(nrows=3, ncols=2, height_ratios=[1, 1, 2])

#  Varying density along a streamline
ax0 = fig.add_subplot(gs[0, 0])
ax0.streamplot(X, Y, U, V, density=[0.5, 1])
ax0.streamplot(X, Y, U, V, color='orange', linewidth=2,
                         cmap='autumn', start_points=seed_points.T)
#plt.plot(0,0,'rx') 
ax0.set_title('alpha=-1.0')
w = 3
alpha=1.0
Y, X = np.mgrid[-w:w:25j, -w:w:25j]
U = alpha-X**2
V = -Y
seed_points = np.array([[3,0,3,0,-1,-1,-1], [-3,-3,3,3,-3,0,3]])

fig = plt.figure(figsize=(15, 15))
gs = gridspec.GridSpec(nrows=3, ncols=2, height_ratios=[1, 1, 2])

#  Varying density along a streamline
ax0 = fig.add_subplot(gs[0, 0])
ax0.streamplot(X, Y, U, V, density=[0.5, 1])
ax0.streamplot(X, Y, U, V, color='orange', linewidth=2,
                         cmap='autumn', start_points=seed_points.T)
plt.plot(1,0,'gx') 
plt.plot(-1,0,'ro')
ax0.set_title('alpha=1.0')
w = 3
alpha=1.0
Y, X = np.mgrid[-w:w:25j, -w:w:25j]
U = alpha-2*X**2-3
V = -Y
seed_points = np.array([[3,0,3,0,-1,-1,-1], [-3,-3,3,3,-3,0,3]])

fig = plt.figure(figsize=(15, 15))
gs = gridspec.GridSpec(nrows=3, ncols=2, height_ratios=[1, 1, 2])

#  Varying density along a streamline
ax0 = fig.add_subplot(gs[0, 0])
ax0.streamplot(X, Y, U, V, density=[0.5, 1])
ax0.streamplot(X, Y, U, V, color='orange', linewidth=2,
                         cmap='autumn', start_points=seed_points.T)
#plt.plot(0,0,'rx') 
ax0.set_title('alpha=1.0')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.2179518365361226, 'fraction_numerical': 0.0666504500121625, 'mean_word_length': 4.534320323014805, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '66443', 'license': 'MIT', 'n_tokens_mistral': 1985, 'n_tokens_neox': 1899, 'n_words': 325, 'path': 'Exercise_3/Task_2.ipynb', 'repo_name': 'Schnursenkel/mlcms_group_g', 'size': '4111'}