In [2]:
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
In [305]:
t = np.array([1+2j])
t = np.array([0, 1, 2, 3]) + np.empty(4)*0j
x = (-t)**0.5

fig, ax = plt.subplots(figsize=(20, 10))
ax.plot(t.real, t.imag, '+')
ax.plot(x.real, x.imag, '+');
In [296]:
n = 1024*10
x = np.hstack([np.random.randn(np.int(n*0.2)) * 0.2 + 3,
               np.random.randn(np.int(n*1.0)) * 0.5 + 7,
               np.random.randn(np.int(n*1.0)) * 0.3 + 9,
               np.random.randn(np.int(n*1.0)) * 0.7 + 13,
])
hist = np.histogram(x, bins=200)
fig, ax = plt.subplots(figsize=(20, 10))
x_ax, y_ax = hist[1][:-1], hist[0]+10

m = np.sum(y_ax)
ax.plot(x_ax, y_ax/m, label='q=1')

#m = np.sum(y_ax**2)
#ax.plot(x_ax, y_ax**2/m, label='q=2')

#m = np.sum(y_ax**3)
#ax.plot(x_ax, y_ax**3/m, label='q=3')

m = np.sum(y_ax**0.5)
ax.plot(x_ax, y_ax**0.5/m, label='q=0.5')

m = np.sum(y_ax**0.1)
ax.plot(x_ax, y_ax**0.1/m, label='q=0.1')

m = np.sum(y_ax**0.01)
ax.plot(x_ax, y_ax**0.01/m, label='q=0.01')

#m = np.sum(y_ax**-0.1)
#ax.plot(x_ax, y_ax**-0.1/m, label='q=-0.1')

ax.legend();
In [294]:
#1 - 1j > 0 + 1j
t = np.linspace(-3, 3, 1024) + 0j
len(t[t.real < 0])
Out[294]:
512
In [293]:
t = np.linspace(-3, 3, 1024) + 0j
tn = t[t.real < 0]
fig, ax = plt.subplots(2, 1, figsize=(20, 20))
exps = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5]
exps = np.array([-5, -4])
exps += 4
magma = plt.cm.magma(np.linspace(0, .9, len(exps)))
for i, exp in enumerate(exps):
    line = '-'
    if i % 3 == 0:
        line = '--'
    ax[0].plot(t.real, (t**exp).real, line, label=f'$t^{{{exp}}}$', color=magma[i])
    ax[1].plot(-t.real, -(t**exp).real, line, label=f'$t^{{{exp}}}$', color=magma[i])
    #ax[1].plot(t.real, (t**exp).imag, line, label=f'$t^{{{exp}}}$', color=magma[i])
expsp = [-4.5, -4.2, -4.01, -3.99, -3.7, -3.5, -2.5, -1.5, ] #-.9, -.7, -.5, -.3, -.1, .1, .3, .5, .7, .9, 1.5, 2.5, 3.5]
expsp = np.array([-4.9, -4.8, -4.7, -4.6, -4.5, -4.4, -4.3, -4.2, -4.1, ]) #-3.9, -3.8, -3.7, -3.6, -3.5, -3.4, -3.3, -3.2, -3.1])
expsp += 4
summer = plt.cm.summer(np.linspace(0, 1, len(expsp)))
for i, exp in enumerate(expsp):
    line = '-'
    if i % 3 == 0:
        line = '--'
    ax[0].plot(tn.real, (tn**exp).real, line, label=f'$t^{{{exp}}}$', color=summer[i])
    ax[1].plot(tn.real, (tn**exp).imag, line, label=f'$t^{{{exp}}}$', color=summer[i], alpha=.2)
ax[0].set(xlim=(-3, 3), ylim=(-3, 3))
ax[0].legend(ncol=3);
ax[1].set(xlim=(-3, 3), ylim=(-3, 3))
ax[1].legend(ncol=3);
In [292]:
t = np.linspace(-3, 3, 1024)
tp = t[t >= 0]
fig, ax = plt.subplots(figsize=(20, 10))
exps = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5]
magma = plt.cm.magma(np.linspace(0, .9, len(exps)))
for i, exp in enumerate(exps):
    line = '-'
    if i % 3 == 0:
        line = '--'
    ax.plot(t, t**exp, line, label=f'$t^{{{exp}}}$', color=magma[i])
expsp = [-4.5, -3.5, -2.5, -1.5, -.9, -.7, -.5, -.3, -.1, .1, .3, .5, .7, .9, 1.5, 2.5, 3.5]
summer = plt.cm.summer(np.linspace(0, 1, len(expsp)))
for i, exp in enumerate(expsp):
    line = '-'
    if i % 3 == 0:
        line = '--'
    ax.plot(tp, tp**exp, line, label=f'$t^{{{exp}}}$', color=summer[i])
ax.set(xlim=(-3, 3), ylim=(-3, 3))
ax.legend(ncol=3);
In [65]:
t = np.linspace(-3, 3, 1024)
tp = t[t >= 0]
fig, ax = plt.subplots(figsize=(20, 10))
exps     = np.array([-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5])
div_exps = exps - 1
div_muls = exps
magma = plt.cm.magma(np.linspace(0, .9, len(exps)))
for i, exp in enumerate(exps):
    line = '-'
    if i % 3 == 0:
        line = '--'
    ax.plot(t**exp, div_muls[i]*t**div_exps[i], line, label=f'$t^{{{exp}}}$', color=magma[i])
ax.plot(t, t, ':', color='black', alpha=.1)
ax.set(xlim=(-3, 3), ylim=(-3, 3))
ax.legend(ncol=3);
In [63]:
t = np.linspace(-3, 3, 1024)
tp = t[t >= 0]
fig, ax = plt.subplots(figsize=(20, 10))
exps     = np.array([-4.5, -3.5, -2.5, -1.5, -.7, -.5, -.3, -.2, -.1, .1, .2, .3, .5, .7, 1.5, 2.5, 3.5, 4.5])
div_exps = exps - 1
div_muls = exps
magma = plt.cm.magma(np.linspace(0, .9, len(exps)))
for i, exp in enumerate(exps):
    line = '-'
    if i % 3 == 0:
        line = '--'
    ax.plot(tp**exp, div_muls[i]*tp**div_exps[i], line, label=f'$t^{{{exp}}}$', color=magma[i])
ax.plot(t, t, ':', color='black', alpha=.1)
ax.set(xlim=(-3, 3), ylim=(-3, 3))
ax.legend(ncol=3);