numerical_function_spaces.orlicz_spaces
Submodules
Attributes
Functions
|
Calculates the kappa value for a given set of parameters. |
|
Calculates the p_Amemiya norm for a given set of parameters. |
|
Computes the Orlicz norm and k^{*} and k^{**} of the function "x(t)" |
|
Computes the Luxemburg norm and k^{*} and k^{**} of the function "x(t)" |
|
Computes the p-Amemiya norm and k^{*} and k^{**} of the function "x(t)" |
|
Computes the p-Amemiya norm and k^{*} and k^{**} of the function "x(t)" |
Phi(u) = u^2 |
|
Phi(u) = u^2 if u<=1 else u^3 |
|
Phi(u) = 0 if u<=1 else u-1 |
|
Phi(u) = u if u<=1 else np.inf |
|
Phi(u) = u |
|
Phi(u) = 0 if u<=1 else np.inf |
|
|
Saves the current figure in different formats (PNG, SVG, PDF) with a given name and p_norm. |
|
Set description for plots |
|
Plot the p-norms of a given signal x for a range of p values. |
|
Plot kappa() function and (optionally) save the current figure in different formats (PNG, SVG, PDF) in plots folder. |
|
Plot Orlicz_function, right side derivative and conjugate function on one plot |
|
Plot Orlicz_function, right side derivative and conjugate function on one plot |
|
Calculate domain and values of alpha() function. |
|
Plot kappa() function and (optionally) save the current figure in different formats (PNG, SVG, PDF) in plots folder. |
|
Calculate domain and values of tau() function. |
|
Plot tau() function and (optionally) save the current figure in different formats (PNG, SVG, PDF) in plots folder. |
|
Calculates the right-side derivative of the Orlicz function for a given set of parameters. |
|
Calculates the conjugate function Psi of the Orlicz function for a given set of parameters. |
Package Contents
- numerical_function_spaces.orlicz_spaces.__version__
- numerical_function_spaces.orlicz_spaces.kappa(Orlicz_function, x, k, p_norm)[source]
Calculates the kappa value for a given set of parameters.
- Parameters:
Orlicz_function (function) – The Orlicz function to be used.
x (np.ndarray) – A 2D numpy array representing x(t).
k (float) – must be positive.
p_norm (float) – The p-norm to be calculated.
- Returns:
The kappa value
- Return type:
np.float64.
- Raises:
ValueError – If x[1, :] contains non-positive values.:
Examples
>>> x = np.array([[1],[1]]) >>> def Orlicz_function(u): ... return u ... >>> kappa(Orlicz_function, x=x, k=1, p_norm=1) np.float64(2.0)
- numerical_function_spaces.orlicz_spaces.p_Amemiya_norm(Orlicz_function, x: numpy.ndarray, p_norm: float)[source]
Calculates the p_Amemiya norm for a given set of parameters.
- Parameters:
Orlicz_function (function) – The Orlicz function to be used.
x (np.ndarray) – A 2D numpy array representing x(t).
p_norm (float) – The p-norm to be calculated.
- Returns:
value of the p-Amemiya norm
- Return type:
np.float64.
- Raises:
ValueError – If x[1, :] contains non-positive values.:
Examples
>>> x = np.array([[1],[1]]) >>> def Orlicz_function(u): ... return u ... >>> p_Amemiya_norm(Orlicz_function, x=x, p_norm=1) np.float64(1.0)
- numerical_function_spaces.orlicz_spaces.Orlicz_norm_with_stars(Orlicz_function, x: numpy.ndarray, k_min: float = 1e-06, k_max: float = 100, dk: float = None, len_domain_k: int = 1000, show_progress: bool = False)[source]
Computes the Orlicz norm and k^{*} and k^{**} of the function “x(t)” in Orlicz space for a given set of parameters as p_Amimiya norm for p_norm=1
- Parameters:
Orlicz_function (function) – The Orlicz function to be used.
x (np.ndarray) – A 2D numpy array representing x(t).
k_min (float, optional) – The minimum value of the k domain, by default 0.000001.
k_max (float, optional) – The maximum value of the k domain, by default 100.
dk (float, optional) – Step of k_domain, by default None When given, more important than len_domain_k
len_domain_k (int, optional) – The number of points in the k domain, by default 1000.
show_progress (bool, optional) – Whether to show a progress bar during computation, by default, False.
- Return type:
A tuple containing the value of the Orlicz norm, k^{*}, k^{**}.
Examples
>>> x = np.array([[1],[2]]) >>> def Orlicz_function(u): ... return np.where(u <= 1, 0, u - 1) ... >>> Orlicz_norm_with_stars(Orlicz_function, x) (np.float64(1.000008302431002), np.float64(1.0000083024999329), np.float64(1.0000083024999329))
- numerical_function_spaces.orlicz_spaces.Luxemburg_norm_with_stars(Orlicz_function, x: numpy.ndarray, k_min: float = 1e-06, k_max: float = 100, dk: float = None, len_domain_k: int = 1000, show_progress: bool = False)[source]
Computes the Luxemburg norm and k^{*} and k^{**} of the function “x(t)” in Orlicz space for a given set of parameters as p_Amimiya norm for p_norm=np.inf
- Parameters:
Orlicz_function (function) – The Orlicz function to be used.
x (np.ndarray) – A 2D numpy array representing x(t).
k_min (float, optional) – The minimum value of the k domain, by default 0.000001.
k_max (float, optional) – The maximum value of the k domain, by default 100.
dk (float, optional) – Step of k_domain, by default None When given, more important than len_domain_k
len_domain_k (int, optional) – The number of points in the k domain, by default 1000.
show_progress (bool, optional) – Whether to show a progress bar during computation, by default, False.
- Return type:
A tuple containing the value of the Luxemburg norm, k^{*}, k^{**}.
Examples
>>> x = np.array([[1],[2]]) >>> def Orlicz_function(u): ... return np.where(u <= 1, 0, u - 1) ... >>> Luxemburg_norm_with_stars(Orlicz_function, x) (np.float64(0.666712308582787), np.float64(1.4998973127189956), np.float64(1.4998973127189956))
- numerical_function_spaces.orlicz_spaces.p_Amemiya_norm_with_stars(Orlicz_function, x: numpy.ndarray, p_norm: float, k_min: float = 1e-06, k_max: float = 100, dk: float = None, len_domain_k: int = 1000, show_progress: bool = False)[source]
Computes the p-Amemiya norm and k^{*} and k^{**} of the function “x(t)” in Orlicz space for a given set of parameters
- Parameters:
Orlicz_function (function) – The Orlicz function to be used.
x (np.ndarray) – A 2D numpy array representing x(t).
p_norm (float) – The p-norm to be calculated.
k_min (float, optional) – The minimum value of the k domain, by default 0.000001.
k_max (float, optional) – The maximum value of the k domain, by default 100.
dk (float, optional) – Step of k_domain, by default None When given, more important than len_domain_k
len_domain_k (int, optional) – The number of points in the k domain, by default 1000.
show_progress (bool, optional) – Whether to show a progress bar during computation, by default, False.
- Return type:
A tuple containing the value of the p-Amemiya norm, k^{*}, k^{**}.
Note
Precision problem with k^{*} false less than k^{**} for Phi = max(u,2u-1), x=chi_(0,3), p=20. Too small accuracy.
Problem eliminated in slower function p_Amemiya_norm_with_stars_by_decimal().
Examples
>>> x = np.array([[1],[1]]) >>> def Orlicz_function(u): ... return u**2 ... >>> p_Amemiya_norm_with_stars(Orlicz_function, x=x, p_norm=1) (np.float64(2.000000000068931), np.float64(1.0000083024999067), np.float64(1.0000083024999067))
- numerical_function_spaces.orlicz_spaces.p_Amemiya_norm_with_stars_by_decimal(Orlicz_function, x: numpy.ndarray, p_norm: decimal.Decimal, k_min: decimal.Decimal = dc.Decimal(1) / 100000, k_max: decimal.Decimal = dc.Decimal(100), dk: decimal.Decimal = None, len_domain_k: int = 1000, show_progress: bool = False) tuple[source]
Computes the p-Amemiya norm and k^{*} and k^{**} of the function “x(t)” in Orlicz space for a given set of parameters
- Parameters:
Orlicz_function (function) – The Orlicz function to be used in form accepting decimal numbers
x (np.ndarray) – A 2D numpy array representing x(t).
p_norm (float) – The p-norm to be calculated (in decimal form).
k_min (float, optional) – The minimum value of the k domain in decimal form, by default 1/100000.
k_max (float, optional) – The maximum value of the k domain in decimal form, by default 100.
dk (float, optional) – Step of k_domain, by default None When given, more important than len_domain_k
len_domain_k (int, optional) – The number of points in the k domain in decimal form, by default 1000.
show_progress (bool, optional) – Whether to show a progress bar during computation, by default False.
- Return type:
A tuple containing the minimum value of the p-Amemiya norm, k^{*}, k^{**}, kappa_domain, and kappa_values.
- Raises:
- ValueError – If any value in x[1, :] is less than or equal to 0.:
Examples
>>> x = np.array([[1], [2]]) >>> def Orlicz_function(u): ... return np.where(u <= 1, u, dc.Decimal(np.inf)) ... >>> dc.getcontext().prec = 20 >>> p_Amemiya_norm_with_stars_by_decimal(Orlicz_function, x=x, p_norm=dc.Decimal(np.inf), ... k_min = dc.Decimal(4)/10, ... k_max = dc.Decimal(11)/10, ... dk = dc.Decimal(1)/100) ... (Decimal('1.9999999999999999999'), Decimal('0.50'), Decimal('1.00'))
- numerical_function_spaces.orlicz_spaces.Orlicz_function_u_2_u_3(u)[source]
Phi(u) = u^2 if u<=1 else u^3
- numerical_function_spaces.orlicz_spaces.Orlicz_function_L_1_sum_L_inf(u)[source]
Phi(u) = 0 if u<=1 else u-1
- numerical_function_spaces.orlicz_spaces.Orlicz_function_L_1_cap_L_inf(u)[source]
Phi(u) = u if u<=1 else np.inf
- numerical_function_spaces.orlicz_spaces.Orlicz_function_L_inf(u)[source]
Phi(u) = 0 if u<=1 else np.inf
- numerical_function_spaces.orlicz_spaces.plot_save(name: str = 'plot', p_norm: float = '')[source]
Saves the current figure in different formats (PNG, SVG, PDF) with a given name and p_norm.
- Parameters:
name (str) – The name to be used for the saved files. Default is ‘plot’.
p_norm (float) – The p-norm value to be included in the file names. Default is an empty string.
- Returns:
The function saves the figure in folder ‘plots’
- Return type:
None
- numerical_function_spaces.orlicz_spaces.description_for_plot(p_norm: float)[source]
Set description for plots
- Parameters:
p_norm (float) – The p-norm value to be included in plot description
- numerical_function_spaces.orlicz_spaces.plot_p_norms(Orlicz_function, x, p_min=1, p_max=50, dp=2, attach_inf=False, show_progress=False, figsize: tuple = (5, 4), show: bool = False, save: bool = False)[source]
Plot the p-norms of a given signal x for a range of p values.
- Parameters:
Orlicz_function (function) – The Orlicz function to be used in form accepting decimal numbers
x (np.ndarray) – A 2D numpy array representing x(t).
p_min (float greater or equal 1) – The minimum value of the p domain. Default is 1.
p_max (float smaller than infinity) – The maximum value of the p domain. Default is 50.
dp (positive float) – The step of the p domain. Default is 2.
attach_inf (bool) – Whether to attach infinity norm to the plot. Default is False.
show_progress (bool) – Whether to show a progress bar during computation. Default is False.
figsize (tuple) – The size of the plot. Default is (5, 4).
show (bool) – Whether to show the plot. Default is False.
save (bool) – Whether to save the plot in different formats (PNG, SVG, PDF) in the ‘plots’ folder. Default is False.
- Returns:
The function generates a figure and (optionally) save in folder ‘plots’
- Return type:
Matplotlib figure
- numerical_function_spaces.orlicz_spaces.plot_kappa(Orlicz_function, x: numpy.ndarray, p_norm: float, k_min: float = 0.01, k_max: float = 10, dk: float = None, len_domain_k: int = 1000, show_progress: bool = False, figsize: tuple = (5, 4), show: bool = False, save: bool = False, save_name: str = None, title: str = None)[source]
Plot kappa() function and (optionally) save the current figure in different formats (PNG, SVG, PDF) in plots folder.
- Parameters:
Orlicz_function (function) – The Orlicz function to be used in form accepting decimal numbers
x (np.ndarray) – A 2D numpy array representing x(t).
k_min (float, optional) – The minimum value of the k domain in decimal form, by default 0.01.
k_max (float, optional) – The maximum value of the k domain in decimal form, by default 10.
dk (float, optional) – Step of k_domain, by default None When given, more important than len_domain_k
len_domain_k (int, optional) – The number of points in the k domain, by default 1000.
show_progress (bool, optional) – Whether to show a progress bar during computation, by default False.
figsize (tuple, optional) – Size of plots, by default (5,4)
show (bool, optional) – Whether to show plot, by default False.
save (bool, optional) – Whether to save plot in pdf, png, svg formats in plots folder, by default False.
save_name (string, optional) – Name for saved plots, by default ‘kappa_{p_norm}.pdf’
title (string, optional) – Title for plots, by default ‘kappa_{p,x}(k)’
- Returns:
The function generates a figure and (optionally) save in folder ‘plots’
- Return type:
Matplotlib figure
- numerical_function_spaces.orlicz_spaces.plot_Phi_p_plus_Psi(Orlicz_function, u_max: float, du: float, max_u_on_plots: float, p_plus: numpy.ndarray = None, Psi: numpy.ndarray = None, figsize: tuple = (9, 3), show: bool = False, save: bool = False)[source]
Plot Orlicz_function, right side derivative and conjugate function on one plot and (optionally) save the current figure in different formats (PNG, SVG, PDF) in plots folder.
- Parameters:
Orlicz_function (function) – The Orlicz function to be used in form accepting decimal numbers
du (float) – Step of u_domain for Orlicz function
u_max (float) – Right limit of u_domain for Orlicz function (bigger u_max may improve Psi accuracy)
max_u_on_plots (float) – May be the same or smaller to u_max
p_plus (np.ndarray, optional (if given must use the same u_max and du as given for plot)) – A 1D numpy array representing right side derivative p_{+}(u)
Psi (np.ndarray, optional (if given must use the same u_max and du as given for plot)) – A 1D numpy array representing right conjugate function Psi(u)
figsize (tuple, optional) – Size of plots, by default (5,4)
show (bool, optional) – Whether to show plot, by default False.
save (bool, optional) – Whether to save plot in pdf, png, svg formats in plots folder, by default False.
- Returns:
The function generates a figure and (optionally) save in folder ‘plots’
- Return type:
Matplotlib figure
- numerical_function_spaces.orlicz_spaces.plot_Phi(Orlicz_function, u_max: float, du: float, figsize: tuple = (5, 4), show: bool = False, save: bool = False)[source]
Plot Orlicz_function, right side derivative and conjugate function on one plot and (optionally) save the current figure in different formats (PNG, SVG, PDF) in plots folder.
- Parameters:
Orlicz_function (function) – The Orlicz function to be used in form accepting decimal numbers
du (float) – Step of u_domain for Orlicz function
u_max (float) – Right limit of u_domain for Orlicz function
figsize (tuple, optional) – Size of plots, by default (5,4)
show (bool, optional) – Whether to show plot, by default False.
save (bool, optional) – Whether to save plot in pdf, png, svg formats in plots folder, by default False.
- Returns:
The function generates a figure and (optionally) save in folder ‘plots’
- Return type:
Matplotlib figure
- numerical_function_spaces.orlicz_spaces.array_for_alpha(Orlicz_function, du: float, u_max: float, x: numpy.ndarray, p_norm: float, p_plus: numpy.ndarray = None, Psi: numpy.ndarray = None, k_min: float = 0.01, k_max: float = 100, dk: float = None, len_domain_k: int = 1000, show_progress: bool = False)[source]
Calculate domain and values of alpha() function.
- Parameters:
Orlicz_function (function) – The Orlicz function to be used in form accepting decimal numbers
du (float) – Step of u_domain for Orlicz, p_plus and Psi function
u_max (float) – Right limit of u_domain for Orlicz function
x (np.ndarray) – A 2D numpy array representing x(t).
p_norm (float) – The p-norm to be calculated.
p_plus (np.ndarray, optional (must use the same u_max and du as given for plot), by default None) – A 1D numpy array representing right side derivative p_{+}(u)
Psi (np.ndarray, optional (must use the same u_max and du as given for plot), by default None) – A 1D numpy array representing right conjugate function Psi(u)
k_min (float, optional) – The minimum value of the k domain in decimal form, by default 0.01.
k_max (float, optional) – The maximum value of the k domain in decimal form, by default 10.
dk (float, optional) – Step of k_domain, by default None When given, more important than len_domain_k
len_domain_k (int, optional) – The number of points in the k domain, by default 1000.
show_progress (bool, optional) – Whether to show a progress bar during computation, by default False.
- Return type:
Two numpy arrays, first for alpha domain, second for alpha values.
- numerical_function_spaces.orlicz_spaces.plot_alpha(Orlicz_function, du: float, u_max: float, x: numpy.ndarray, p_norm: float, p_plus: numpy.ndarray = None, Psi: numpy.ndarray = None, k_min: float = 0.01, k_max: float = 100, dk: float = None, len_domain_k: int = 1000, show: bool = False, save: bool = False, show_progress: bool = False, save_name: str = None, title: str = None, figsize: tuple = (5, 4))[source]
Plot kappa() function and (optionally) save the current figure in different formats (PNG, SVG, PDF) in plots folder.
- Parameters:
Orlicz_function (function) – The Orlicz function to be used in form accepting decimal numbers
du (float) – Step of u_domain for Orlicz, p_plus and Psi function
u_max (float) – Right limit of u_domain for Orlicz function
x (np.ndarray) – A 2D numpy array representing x(t).
p_norm (float) – The p-norm to be calculated.
p_plus (np.ndarray, optional (must use the same u_max and du as given for plot), by default None) – A 1D numpy array representing right side derivative p_{+}(u)
Psi (np.ndarray, optional (must use the same u_max and du as given for plot), by default None) – A 1D numpy array representing right conjugate function Psi(u)
k_min (float, optional) – The minimum value of the k domain in decimal form, by default 0.01.
k_max (float, optional) – The maximum value of the k domain in decimal form, by default 10.
dk (float, optional) – Step of k_domain, by default None When given, more important than len_domain_k
len_domain_k (int, optional) – The number of points in the k domain, by default 1000.
show_progress (bool, optional) – Whether to show a progress bar during computation, by default False.
figsize (tuple, optional) – Size of plots, by default (5, 4)
show (bool, optional) – Whether to show plot, by default False.
save (bool, optional) – Whether to save plot in pdf, png, svg formats in plots folder, by default False.
save_name (string, optional) – Name for saved plots, by default ‘kappa_{p_norm}.pdf’
title (string, optional) – Title for plots, by default ‘kappa_{p,x}(k)’
Note
In this function there are no warnings about exceeding k^{*} and k^{**} ranges
- Returns:
The function generates a figure and (optionally) save in folder ‘plots’
- Return type:
Matplotlib figure
- numerical_function_spaces.orlicz_spaces.array_for_tau(Orlicz_function, du: float, u_max: float, x: numpy.ndarray, p_norm: float, p_plus: numpy.ndarray = None, Psi: numpy.ndarray = None, k_min: float = 0.01, k_max: float = 100, dk: float = None, len_domain_k: int = 1000, show_progress: bool = False)[source]
Calculate domain and values of tau() function.
- Parameters:
Orlicz_function (function) – The Orlicz function to be used in form accepting decimal numbers
du (float) – Step of u_domain for Orlicz, p_plus and Psi function
u_max (float) – Right limit of u_domain for Orlicz function
x (np.ndarray) – A 2D numpy array representing x(t).
p_norm (float) – The p-norm to be calculated.
p_plus (np.ndarray, optional (must use the same u_max and du as given for plot), by default None) – A 1D numpy array representing right side derivative p_{+}(u)
Psi (np.ndarray, optional (must use the same u_max and du as given for plot), by default None) – A 1D numpy array representing right conjugate function Psi(u)
k_min (float, optional) – The minimum value of the k domain in decimal form, by default 0.01.
k_max (float, optional) – The maximum value of the k domain in decimal form, by default 10.
dk (float, optional) – Step of k_domain, by default None When given, more important than len_domain_k
len_domain_k (int, optional) – The number of points in the k domain, by default 1000.
show_progress (bool, optional) – Whether to show a progress bar during computation, by default False.
- Return type:
Two numpy arrays, first for tau domain, second for tau values.
- numerical_function_spaces.orlicz_spaces.plot_tau(Orlicz_function, du: float, u_max: float, x: numpy.ndarray, p_norm: float, p_plus: numpy.ndarray = None, Psi: numpy.ndarray = None, k_min: float = 0.01, k_max: float = 100, dk: float = None, len_domain_k: int = 1000, show: bool = False, save: bool = False, show_progress: bool = False, save_name: str = None, title: str = None, figsize: tuple = (5, 4))[source]
Plot tau() function and (optionally) save the current figure in different formats (PNG, SVG, PDF) in plots folder.
- Parameters:
Orlicz_function (function) – The Orlicz function to be used in form accepting decimal numbers
du (float) – Step of u_domain for Orlicz, p_plus and Psi function
u_max (float) – Right limit of u_domain for Orlicz function
x (np.ndarray) – A 2D numpy array representing x(t).
p_norm (float) – The p-norm to be calculated.
p_plus (np.ndarray, optional (must use the same u_max and du as given for plot), by default None) – A 1D numpy array representing right side derivative p_{+}(u)
Psi (np.ndarray, optional (must use the same u_max and du as given for plot), by default None) – A 1D numpy array representing right conjugate function Psi(u)
k_min (float, optional) – The minimum value of the k domain in decimal form, by default 0.01.
k_max (float, optional) – The maximum value of the k domain in decimal form, by default 10.
dk (float, optional) – Step of k_domain, by default None When given, more important than len_domain_k
len_domain_k (int, optional) – The number of points in the k domain, by default 1000.
show_progress (bool, optional) – Whether to show a progress bar during computation, by default False.
figsize (tuple, optional) – Size of plots, by default (5, 4)
show (bool, optional) – Whether to show plot, by default False.
save (bool, optional) – Whether to save plot in pdf, png, svg formats in plots folder, by default False.
save_name (string, optional) – Name for saved plots, by default ‘kappa_{p_norm}.pdf’
title (string, optional) – Title for plots, by default ‘kappa_{p,x}(k)’
Note
In this function there are no warnings about exceeding k^{*} and k^{**} ranges
- Returns:
The function generates a figure and (optionally) save in folder ‘plots’
- Return type:
Matplotlib figure
- numerical_function_spaces.orlicz_spaces.right_side_derivative(Orlicz_function, u_max: float, du: float, show_progress: bool = False)[source]
Calculates the right-side derivative of the Orlicz function for a given set of parameters.
- Parameters:
Orlicz_function (function) – The Orlicz function to be used.
u_max (float) – The upper bound of the u domain.
du (float) – The step size for the u domain.
show_progress (bool, optional) – Whether to show a progress bar during computation, by default False.
- Returns:
The right-side derivative of the Orlicz function evaluated at each point in the domain of Orlicz_function.
- Return type:
np.ndarray
Examples
>>> def Orlicz_function(u): ... return np.where(u <= 1, 0, u ** 2 - 1) ... >>> right_side_derivative(Orlicz_function, u_max=5, du=0.5) array([0. , 0. , 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5])
- numerical_function_spaces.orlicz_spaces.conjugate_function(Orlicz_function, u_max, du: float, show_progress: bool = False)[source]
Calculates the conjugate function Psi of the Orlicz function for a given set of parameters.
- Parameters:
Orlicz_function (function) – The Orlicz function to be used.
u_max (float) – The upper bound of the u domain.
du (float) – The step size for the u domain.
show_progress (bool, optional) – Whether to show a progress bar during computation, by default False.
- Returns:
The conjugate function Psi of the Orlicz function evaluated at each point in the domain of Orlicz_function.
- Return type:
np.ndarray
Examples
>>> def Orlicz_function(u): ... return np.where(u <=1, 0, u**2) ... >>> conjugate_function(Orlicz_function, u_max=5, du=0.5) array([0. , 0.5, 1. , 1.5, 2. , 2.5, 3. , 3.5, 4. , 5. ])