How Do I Solve A*(Uxx+Uyy)-B(x)*Ux=0 in Mathematica?

  • Context: Graduate 
  • Thread starter Thread starter JG
  • Start date Start date
Click For Summary
SUMMARY

This discussion focuses on solving the partial differential equation A*(Uxx + Uyy) - B(x)*Ux = 0 using Mathematica. The equation involves boundary conditions (BC) dU/dz = 0 and dU/dy = 0, along with initial conditions (IC) U(0,y) = 1 for -1 < y < 0 and U(0,y) = 1 for 0 < y < 1. A suggested approach includes defining constants and functions in Mathematica, utilizing the DSolve function to find the general solution, and applying numerical methods such as the finite difference method to solve for unknown constants.

PREREQUISITES
  • Understanding of partial differential equations (PDEs)
  • Familiarity with Mathematica syntax and functions
  • Knowledge of boundary and initial conditions in mathematical modeling
  • Experience with numerical methods, particularly finite difference methods
NEXT STEPS
  • Explore the use of Mathematica's DSolve function for solving PDEs
  • Learn about boundary value problems and their applications in PDEs
  • Study the finite difference method for numerical solutions of differential equations
  • Investigate the method of separation of variables for solving PDEs
USEFUL FOR

Mathematicians, physicists, and engineers working with partial differential equations, as well as students and professionals seeking to enhance their skills in Mathematica for solving complex mathematical problems.

JG
Messages
2
Reaction score
0
I must solve A*(Uxx+Uyy)-B(x)*Ux=0 , where Uxx means ssecond partial derivative of U on x and U(x,y); Ais constant and B(x) is function of x! The eq has BC dU/dz=0 and dU/dy=0 IC U(0,y)=1 for -1<y<0 and U(0,y)=1 for 0<y<1 in Mathematica!
Can anybody help me with some example? Thanks, Jan mail: jan_golob@email.si
 
Physics news on Phys.org
JG said:
I must solve A*(Uxx+Uyy)-B(x)*Ux=0 , where Uxx means ssecond partial derivative of U on x and U(x,y); Ais constant and B(x) is function of x! The eq has BC dU/dz=0 and dU/dy=0 IC U(0,y)=1 for -1<y<0 and U(0,y)=1 for 0<y<1 in Mathematica!
Can anybody help me with some example? Thanks, Jan mail: jan_golob@email.si

Hey JG, don't know why others aren't commenting about your problem but for me it is a bit awkwardly posed. This is what I would consider well-posed:

[tex]\text{DE:}\quad Au_{xx}+Au_{yy}-B(x)u_x=0\quad 0\le x \le L[/tex]

[tex]\text{BC:}\quad u_x(0,t)=0\quad u_x(L,t)=0[/tex]

[tex]\text{IC:}\quad u(x,0)=f(x)\quad u_t(x,0)=g(x)[/tex]

Now saying that's yours but if the problem were this, then I'd use separation of variables and proceed.
 
Last edited:


Sure, I can provide an example for solving this equation in Mathematica. First, we need to define the variables and constants:

A = 2; (*constant*)
B[x_] := x^2; (*function of x*)
U[x_, y_] := u[x, y]; (*defining U as a function of x and y*)

Next, we can use the built-in function DSolve to solve the equation:

DSolve[A*(D[U[x, y], {x, 2}] + D[U[x, y], {y, 2}]) - B[x]*D[U[x, y], x] == 0, U[x, y], {x, y}]

This will give us the general solution to the equation:

{{U[x, y] -> C[1] + C[2]*y + (A*Integrate[B[x], x] + C[3])*x + (A*Integrate[B[x], x, x] + C[4])*y^2}}

Next, we can use the boundary conditions to solve for the constants C[1], C[2], C[3], and C[4]. In this case, we have two boundary conditions at x=0 and three unknown constants, so we will need to use a numerical method to solve for the constants. For example, we can use the finite difference method:

(*creating a grid for x and y*)
xgrid = Table[i, {i, -1, 1, 0.1}];
ygrid = Table[j, {j, -1, 1, 0.1}];

(*creating a matrix for the finite difference method*)
matrix = Table[0, {i, Length[xgrid]}, {j, Length[ygrid]}];

(*filling in the matrix with the equation*)
Do[
If[i == 1, matrix[[i, j]] = D[U[xgrid[], ygrid[[j]]], y]; (*boundary condition at x=0*)
matrix[[i, j]] = 0; (*boundary condition at y=0*)
,
matrix[[i, j]] = A*(D[U[xgrid[], ygrid[[j]]], {x, 2}] + D[U[xgrid[], ygrid[[j]]], {y, 2}]) - B[xgrid[]]*D[U[xgrid[[i
 

Similar threads

  • · Replies 12 ·
Replies
12
Views
5K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
Replies
6
Views
2K
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 1 ·
Replies
1
Views
6K