Right side derivative and conjugate function
- link to interactive notebooks session.
import numpy as np
import numerical_function_spaces.orlicz_spaces as osm
Denote by \(p_{+}\) (p_plus) the right-hand side derivative of \(\Phi \) with the domain restricted to the interval \(\left[ 0,\infty \right) .\) For any Orlicz function \(\Phi\) we define function \(\Psi \) by the formula
\[\begin{equation*}
\Psi \left( u\right) =\sup \left\{ \left\vert u\right\vert v-\Phi \left(
v\right) :v\geq 0\right\} \text{ for all } u\in\mathbb{R}
\end{equation*}\]
Function \(\Psi\) is called conjugated to \(\Phi \) in the sense of Young. It is also known as Legendre transform.
def Orlicz_function(u):
# return np.where(u <=1, 0, u - 1)
# or
Phi = np.zeros(len(u))
for i in range(len(u)):
if u[i] <= 1:
Phi[i] = 0
else:
Phi[i] = u[i] - 1
return Phi
p_plus = osm.right_side_derivative(Orlicz_function, u_max=3, du=0.2)
u = np.arange(0, 3, 0.2)
for i in range(len(u)):
print(f"p_plus({u[i]})= {p_plus[i]}")
p_plus(0.0)= 0.0
p_plus(0.2)= 0.0
p_plus(0.4)= 0.0
p_plus(0.6000000000000001)= 0.0
p_plus(0.8)= 0.0
p_plus(1.0)= 1.0000000000000009
p_plus(1.2000000000000002)= 0.9999999999999998
p_plus(1.4000000000000001)= 0.9999999999999998
p_plus(1.6)= 0.9999999999999998
p_plus(1.8)= 0.9999999999999998
p_plus(2.0)= 1.0000000000000009
p_plus(2.2)= 1.0000000000000009
p_plus(2.4000000000000004)= 0.9999999999999987
p_plus(2.6)= 1.0000000000000009
p_plus(2.8000000000000003)= 0.9999999999999987
Psi = osm.conjugate_function(Orlicz_function, u_max=5, du=0.5)
b_Psi = 1.5 ?
trying to extend domain of Phi to check b_Psi - it may take a lot of time - press CTRL+C to exit (may not work) or interrupt cell
1-rd extending of the Phi domain to check b_Psi
u_max = 50.5
Counting Phi for extended domain
YES: b_Psi = 1.5
u = np.arange(0, 5, 0.5)
for i in range(len(u)):
print(f"Psi({u[i]})= {Psi[i]}")
Psi(0.0)= 0.0
Psi(0.5)= 0.5
Psi(1.0)= 1.0
Psi(1.5)= inf
Psi(2.0)= inf
Psi(2.5)= inf
Psi(3.0)= inf
Psi(3.5)= inf
Psi(4.0)= inf
Psi(4.5)= inf
osm.plot_Phi_p_plus_Psi(Orlicz_function, u_max=100, du=0.01, max_u_on_plots=5)
b_Psi = 1.01 ?
trying to extend domain of Phi to check b_Psi - it may take a lot of time - press CTRL+C to exit (may not work) or interrupt cell
1-rd extending of the Phi domain to check b_Psi
u_max = 1010.0
Counting Phi for extended domain
YES: b_Psi = 1.01
Orlicz_function = osm.Orlicz_function_L_1_cap_L_inf
osm.plot_Phi_p_plus_Psi(Orlicz_function, u_max=10, du=0.01, max_u_on_plots=10)
def Orlicz_function(u):
res = np.zeros(len(u))
for i in range(len(u)):
n = -1
while True:
if u[i] > n and u[i] <= n + 1: # below two congjugated functions?
res[i] = (n + 1) * u[i] - (n + 1) * n / 2
# res[i] = n * u[i] - (n) * (n + 1) / 2
break
n = n + 1
return res
osm.plot_Phi_p_plus_Psi(Orlicz_function, u_max=10, du=0.01, max_u_on_plots=10)
def Orlicz_function(u):
return np.where(u < 1, u / (1 - u), np.inf)
osm.plot_Phi_p_plus_Psi(Orlicz_function, u_max=10, du=0.01, max_u_on_plots=10)
/tmp/ipykernel_678/1153624846.py:2: RuntimeWarning: divide by zero encountered in divide
return np.where(u < 1, u / (1 - u), np.inf)
def Orlicz_function(u):
# return np.where(u <= 2, u / 2, np.where(u <= 4, (u / 2) ** (u / 2), np.inf))
# or
Phi = np.zeros(len(u))
for i in range(len(u)):
if u[i] <= 2:
Phi[i] = u[i] / 2
elif u[i] <= 4:
Phi[i] = (u[i] / 2) ** (u[i] / 2)
else:
Phi[i] = np.inf
return Phi
osm.plot_Phi_p_plus_Psi(Orlicz_function, u_max=10, du=0.01, max_u_on_plots=10)
def Orlicz_function(u):
return 3 * (u - np.log(u + 1))
osm.plot_Phi_p_plus_Psi(Orlicz_function, u_max=10, du=0.001, max_u_on_plots=10)
b_Psi = 2.728 ?
trying to extend domain of Phi to check b_Psi - it may take a lot of time - press CTRL+C to exit (may not work) or interrupt cell
1-rd extending of the Phi domain to check b_Psi
u_max = 101.0
Counting Phi for extended domain
new_b_Psi > b_Psi - problem with domain and/or slowly increasing of Phi
old_b_Psi 2.728 new_b_Psi 2.971
trying to extend domain of Phi to check b_Psi - it may take a lot of time - press CTRL+C to exit (may not work) or interrupt cell
2-rd extending of the Phi domain to check b_Psi
u_max = 329.4900436770063
Counting Phi for extended domain
new_b_Psi > b_Psi - problem with domain and/or slowly increasing of Phi
old_b_Psi 2.971 new_b_Psi 2.991
trying to extend domain of Phi to check b_Psi - it may take a lot of time - press CTRL+C to exit (may not work) or interrupt cell
3-rd extending of the Phi domain to check b_Psi
u_max = 742.8137844855637
Counting Phi for extended domain
new_b_Psi > b_Psi - problem with domain and/or slowly increasing of Phi
old_b_Psi 2.991 new_b_Psi 2.996
trying to extend domain of Phi to check b_Psi - it may take a lot of time - press CTRL+C to exit (may not work) or interrupt cell
4-th extending of the Phi domain to check b_Psi
u_max = 1395.211836892324
Counting Phi for extended domain
new_b_Psi > b_Psi - problem with domain and/or slowly increasing of Phi
old_b_Psi 2.996 new_b_Psi 2.998
trying to extend domain of Phi to check b_Psi - it may take a lot of time - press CTRL+C to exit (may not work) or interrupt cell
5-th extending of the Phi domain to check b_Psi
u_max = 2350.7829260210424
Counting Phi for extended domain
new_b_Psi > b_Psi - problem with domain and/or slowly increasing of Phi
old_b_Psi 2.998 new_b_Psi 2.999
trying to extend domain of Phi to check b_Psi - it may take a lot of time - press CTRL+C to exit (may not work) or interrupt cell
6-th extending of the Phi domain to check b_Psi
u_max = 3685.555749754256
Counting Phi for extended domain
new_b_Psi > b_Psi - problem with domain and/or slowly increasing of Phi
old_b_Psi 2.999 new_b_Psi 3.0
trying to extend domain of Phi to check b_Psi - it may take a lot of time - press CTRL+C to exit (may not work) or interrupt cell
7-th extending of the Phi domain to check b_Psi
u_max = 5489.618683519976
Counting Phi for extended domain
YES: b_Psi = 3.0
def Orlicz_function(u):
# return np.where(u <= 1, 1 - np.sqrt(1 - u ** 2), np.inf)
# or
Phi = np.zeros(len(u))
for i in range(len(u)):
if u[i] <= 1:
Phi[i] = 1 - np.sqrt(1 - u[i] ** 2)
else:
Phi[i] = np.inf
return Phi
osm.plot_Phi_p_plus_Psi(Orlicz_function, u_max=3, du=0.01, max_u_on_plots=10)
def Orlicz_function(u):
return 3 * u * np.log(u + 2) - np.log(u + 1)
osm.plot_Phi_p_plus_Psi(Orlicz_function, u_max=30, du=0.01, max_u_on_plots=10)
b_Psi = 13.18 ?
trying to extend domain of Phi to check b_Psi - it may take a lot of time - press CTRL+C to exit (may not work) or interrupt cell
1-rd extending of the Phi domain to check b_Psi
u_max = 303.0
Counting Phi for extended domain
new_b_Psi > b_Psi - problem with domain and/or slowly increasing of Phi
old_b_Psi 13.18 new_b_Psi 20.14
trying to extend domain of Phi to check b_Psi - it may take a lot of time - press CTRL+C to exit (may not work) or interrupt cell
2-rd extending of the Phi domain to check b_Psi
u_max = 988.470131031019
Counting Phi for extended domain
new_b_Psi > b_Psi - problem with domain and/or slowly increasing of Phi
old_b_Psi 20.14 new_b_Psi 23.69
trying to extend domain of Phi to check b_Psi - it may take a lot of time - press CTRL+C to exit (may not work) or interrupt cell
3-rd extending of the Phi domain to check b_Psi
u_max = 2228.441353456691
Counting Phi for extended domain
new_b_Psi > b_Psi - problem with domain and/or slowly increasing of Phi
old_b_Psi 23.69 new_b_Psi 26.13
trying to extend domain of Phi to check b_Psi - it may take a lot of time - press CTRL+C to exit (may not work) or interrupt cell
4-th extending of the Phi domain to check b_Psi
u_max = 4185.635510676972
Counting Phi for extended domain
new_b_Psi > b_Psi - problem with domain and/or slowly increasing of Phi
old_b_Psi 26.13 new_b_Psi 28.02
trying to extend domain of Phi to check b_Psi - it may take a lot of time - press CTRL+C to exit (may not work) or interrupt cell
5-th extending of the Phi domain to check b_Psi
u_max = 7052.348778063128
Counting Phi for extended domain
new_b_Psi > b_Psi - problem with domain and/or slowly increasing of Phi
old_b_Psi 28.02 new_b_Psi 29.59
trying to extend domain of Phi to check b_Psi - it may take a lot of time - press CTRL+C to exit (may not work) or interrupt cell
6-th extending of the Phi domain to check b_Psi
u_max = 11056.66724926277
Counting Phi for extended domain
new_b_Psi > b_Psi - problem with domain and/or slowly increasing of Phi
old_b_Psi 29.59 new_b_Psi 30.0