Non Linear PDE with an Eigen Value

70 views
Skip to first unread message

Mayank Pandey

unread,
Nov 30, 2023, 12:19:59 PM11/30/23
to chebfun-users
Hi,
     I have a non-linear PDE with appropriate boundary conditions and U as a eigen value.
     
     Can this be solve using chebfun??

Thank You
mayank,PDE1.png

iajze...@gmail.com

unread,
Jan 15, 2024, 9:52:58 PM1/15/24
to chebfun-users
Is the following any use?
ChatGPT 4
User
Have a non linear PDE with appropriate boundary conditions and U as an eigen value. Can this be solved by matlab chebfun ? Generate a complete matlab chebfun demo code solution.
4 / 4
ChatGPT

Solving a non-linear partial differential equation (PDE) with appropriate boundary conditions where UU is an eigenvalue using Matlab's Chebfun can be quite involved. Chebfun is a powerful tool for numerical computing, particularly for dealing with functions and operators. To create a complete demo code, I'll outline a general approach for a typical non-linear PDE, assuming you are familiar with Matlab and Chebfun.

Let's consider a simple example: solving the non-linear PDE given by

∂2U∂x2+λU+U3=0∂x2∂2U​+λU+U3=0

with boundary conditions U(0)=U(1)=0U(0)=U(1)=0, where λλ is the eigenvalue.

Here's how you could set up and solve this problem using Matlab's Chebfun:

matlab

% Add Chebfun to the Matlab path
addpath('/path/to/chebfun'); % Update with the actual path
chebfun('startup');

% Define the domain
dom = [0, 1];

% Define the differential operator
N = chebop(@(x, u) diff(u, 2) + lambda*u + u.^3, dom);

% Set boundary conditions
N.lbc = 0;
N.rbc = 0;

% Guess for the eigenvalue
lambda = 1;

% Solve the eigenvalue problem
[U, lambda] = eigs(N, 1, lambda);

% Plot the solution
plot(U);
title('Solution of the Non-Linear PDE');
xlabel('x');
ylabel('U(x)');

This code sets up and solves a non-linear eigenvalue problem using Chebfun's chebop functionality. Note that the initial guess for λλ and the exact form of the PDE can significantly influence the solution process and outcome. The eigs function is used to find the eigenfunctions and eigenvalues.

Keep in mind that this is a simplified example. Real-world non-linear PDEs might require more complex setups, including better guesses for eigenvalues, handling of more complex boundary conditions, or dealing with systems of equations. Chebfun's documentation and examples are excellent resources for more advanced usage.
Is this conversation helpful so far?
ChatGPT can make mistakes. Consider checking important information.

ChatGPT

iajze...@gmail.com

unread,
Jan 15, 2024, 10:20:59 PM1/15/24
to chebfun-users


On Tuesday 16 January 2024 at 13:52:58 UTC+11 iajze...@gmail.com wrote:
Hi, I have a non-linear PDE with appropriate boundary conditions and U as a eigen value. Can this be solve using chebfun?? Thank You mayank,PDE1.png

Chebfun is a numerical computing system based on representing functions as sums of Chebyshev polynomials, and it is designed to carry out computations that are familiar from classical numerical analysis and computational science in a pure function space setting.

The equation in the image you've uploaded appears to be a nonlinear partial differential equation (PDE). Chebfun has capabilities for solving certain classes of PDEs, typically by discretizing the domain using Chebyshev polynomials and then converting the PDE into a system of algebraic equations. This approach is particularly powerful for problems that can be cast into a form that fits within Chebfun's framework.

However, the ability to solve a given PDE with Chebfun depends on several factors:

  1. Type of PDE: Chebfun is most suited to solve linear PDEs, although it can handle some nonlinear problems as well.
  2. Complexity of Nonlinearity: If the nonlinearity is not too severe, it may be possible to use Chebfun's built-in methods or to implement a continuation method.
  3. Boundary Conditions: The boundary conditions need to be compatible with the spectral methods used by Chebfun.
  4. Dimensionality: Chebfun is most effective for one-dimensional problems, although it can handle problems in two dimensions (Chebfun2) and to some extent in three dimensions (Chebfun3) with certain limitations.

For a nonlinear PDE like the one you've described, particularly if the nonlinearity is significant or if the problem is multidimensional, it may not be straightforward to apply Chebfun directly. In such cases, one might need to resort to other numerical methods that are specifically designed for nonlinear PDEs, such as finite difference methods, finite element methods, or spectral methods with a more manual approach to handling the nonlinearity.

If you have the boundary conditions and additional context for the problem, I could provide more specific advice on whether Chebfun might be appropriate and, if so, how one might go about formulating the problem for solution with Chebfun. If Chebfun is not suitable, I can suggest alternative approaches

iajze...@gmail.com

unread,
Jan 15, 2024, 10:31:00 PM1/15/24
to chebfun-users

User
In addition to the equation in the image, synthesize appropriate boundary conditions and include them in the equation set.
GPT

To synthesize boundary conditions for the given nonlinear PDE, we must consider the physical context or the mathematical properties we wish to simulate or solve for. Without specific context, we can propose generic types of boundary conditions that are commonly used in solving PDEs.

Given that the PDE appears to involve both and derivatives, let's assume it is a two-dimensional problem on a domain with boundary . We can propose the following types of boundary conditions:

  1. Dirichlet Boundary Conditions: Specify the value of the function on the boundary .

    For example, for a square domain :

    where and are given functions of and respectively.

  2. Neumann Boundary Conditions: Specify the value of the normal derivative of on .

    For the same domain as above:

    where and are given functions of and respectively.

  3. Robin Boundary Conditions: A linear combination of Dirichlet and Neumann conditions.

    For example:

    and similarly for the other sides of the domain, where and are given constants or functions defining the linear combination and boundary condition value, respectively.

  4. Periodic Boundary Conditions: The function values and possibly their derivatives are the same at the opposite sides of the domain.

    For example:

    and similarly for and .

These boundary conditions can be chosen based on the specific physical phenomena being modeled, such as heat flow, fluid dynamics, or other diffusion processes. Once the boundary conditions are defined, they can be included with the PDE to form a complete problem that can be approached numerically or analytically.

When using Chebfun or any other numerical method, the boundary conditions will be an essential part of the problem setup, influencing the choice of solution method and potentially the convergence and stability of the numerical solution.

To synthesize boundary conditions for the given nonlinear PDE, we must consider the physical context or the mathematical properties we wish to simulate or solve for. Without specific context, we can propose generic types of boundary conditions that are commonly used in solving PDEs.

Given that the PDE appears to involve both and derivatives, let's assume it is a two-dimensional problem on a domain with boundary . We can propose the following types of boundary conditions:

  1. Dirichlet Boundary Conditions: Specify the value of the function on the boundary .

    For example, for a square domain :

    where and are given functions of and respectively.

  2. Neumann Boundary Conditions: Specify the value of the normal derivative of on .

    For the same domain as above:

    where and are given functions of and respectively.

  3. Robin Boundary Conditions: A linear combination of Dirichlet and Neumann conditions.

    For example:

    and similarly for the other sides of the domain, where and are given constants or functions defining the linear combination and boundary condition value, respectively.

  4. Periodic Boundary Conditions: The function values and possibly their derivatives are the same at the opposite sides of the domain.

    For example:

    and similarly for and .

These boundary conditions can be chosen based on the specific physical phenomena being modeled, such as heat flow, fluid dynamics, or other diffusion processes. Once the boundary conditions are defined, they can be included with the PDE to form a complete problem that can be approached numerically or analytically.

When using Chebfun or any other numerical method, the boundary conditions will be an essential part of the problem setup, influencing the choice of solution method and potentially the convergence and stability of the numerical solution.

iajze...@gmail.com

unread,
Jan 15, 2024, 10:59:29 PM1/15/24
to chebfun-users
Using the equation in the image and the Dirichlet Boundary Conditions: Specify the value of the function T^ on the boundary ∂Ω. For example, for a square domain [a,b]×[c,d]: T^(a,y)=f1​(y),T^(b,y)=f2​(y),T^(x,c)=g1​(x),T^(x,d)=g2​(x) where f1​,f2​,g1​, and g2​ are given functions of y and x respectively.
GPT

To set up the problem with Dirichlet boundary conditions using the equation from the image, let's consider the following mathematical expression of the problem:

  1. The PDE itself, rewritten for clarity:

  1. The Dirichlet boundary conditions on a square domain :

Here, , , , , and are constants or given functions that are part of the PDE. The functions , , , and are the specified values of on the boundaries of the domain.

To solve this PDE with Chebfun in MATLAB, you would typically discretize the domain using Chebyshev polynomials and convert the PDE and boundary conditions into a form that Chebfun can handle. Here is a general outline of steps you might take:

  1. Define the domain in Chebfun.
  2. Create chebfun objects for the functions , , , , and .
  3. Use Chebfun's chebop to set up the differential operator corresponding to the left-hand side of the PDE.
  4. Define the right-hand side of the PDE as a function handle or chebfun object.
  5. Use the dirichlet command or equivalent in Chebfun to impose the boundary conditions.
  6. Solve the PDE using Chebfun's solvebvp or a similar function for boundary value problems.

Here's a conceptual MATLAB code snippet to illustrate the process:

matlab
% Define the domain. a = ...; % start of x-domain b = ...; % end of x-domain c = ...; % start of y-domain d = ...; % end of y-domain dom = [a, b, c, d]; % Create the chebfun variables. x = chebfun('x', [a b]); y = chebfun('y', [c d]); % Define the boundary conditions. f1 = @(y) ...; % Your function of y f2 = @(y) ...; % Your function of y g1 = @(x) ...; % Your function of x g2 = @(x) ...; % Your function of x % Define the differential operator. N = chebop2(@(x, y, T) U/sqrt(Lambda) * diff(T, x) - V * diff(T, y) - ... diff(T, 2, x) - diff(T, 2, y) - omega/(Z_s * Lambda), dom); % Impose the boundary conditions. N.lbc = @(y) f1(y); N.rbc = @(y) f2(y); N.ubc = @(x) g1(x); N.dbc = @(x) g2(x); % Define the right-hand side (if not zero). rhs = @(x, y) 0; % Solve the PDE. T = N \ rhs;

Please note that the actual implementation may vary depending on the specific details of the functions , , , , and the terms in the PDE. The example provided is a generic template and will need to be adjusted to fit the exact problem you are trying to solve.

User
Provide a complete and executable demo code snippet that will run and produce results in matlab-chebfun
GPT

Certainly! Below is a demo code snippet that uses MATLAB with Chebfun to solve a generic two-dimensional PDE with Dirichlet boundary conditions. Please keep in mind that this is a generic template and the specific form of your PDE, including the coefficients and boundary conditions, would need to be specified correctly for your particular problem.

For the sake of demonstration, I'll use placeholder functions for the boundary conditions and assume that all coefficients are constants. You'll need to replace these placeholders with your actual functions and parameters.

matlab
% Ensure Chebfun package is installed and in MATLAB's path addpath('path_to_chebfun'); % Replace with your Chebfun installation path % Define the domain a = 0; b = 1; % x-domain [a, b] c = 0; d = 1; % y-domain [c, d] dom = [a, b, c, d]; % Define parameters (replace with actual values) U = 1; V = 1; Lambda = 1; Zs = 1; omega = 1; % Create chebfun2 variables for the PDE x = chebfun('x', [a b]); y = chebfun('y', [c d]); T = chebfun2(@(x, y) 0, dom); % Initial guess of zero function % Define the boundary condition functions (replace with actual functions) f1 = @(y) sin(pi*y); % Example function for y = a f2 = @(y) cos(pi*y); % Example function for y = b g1 = @(x) exp(x); % Example function for x = c g2 = @(x) exp(1-x); % Example function for x = d % Define the differential operator N = chebop2(@(x, y, T) U/sqrt(Lambda) * diff(T, x) - V * diff(T, y) - ... diff(T, 2, x) - diff(T, 2, y) - omega/(Zs * Lambda), dom); % Impose the Dirichlet boundary conditions N.bc = @(x, y, T) feval(T, a, y) - f1(y); N.bc = @(x, y, T) feval(T, b, y) - f2(y); N.bc = @(x, y, T) feval(T, x, c) - g1(x); N.bc = @(x, y, T) feval(T, x, d) - g2(x); % Solve the PDE T = N \ 0; % Assuming the RHS of the PDE is zero % Plot the solution surf(T), title('Solution T(x,y)') xlabel('x'), ylabel('y'), zlabel('T(x,y)')

This script assumes that the right-hand side of your PDE is zero, which is common for demonstration purposes. If your PDE has a non-zero right-hand side, you'll need to define it accordingly and use it in place of the 0 in the line where N \ 0 is called.

Be sure to replace the boundary condition functions f1, f2, g1, and g2 with the actual functions representing the boundary conditions for your problem. Also, update the parameters U, V, Lambda, Zs, and omega with the values relevant to your PDE.

To execute this code, you'll need MATLAB with the Chebfun package installed. You may also need to adjust the path to the Chebfun package if it is not in MATLAB's default path.

ChatGPT can make mistakes. Consider checking important information.


Reply all
Reply to author
Forward
0 new messages