# Laplace equation in one dimension

**URL:** <https://discourse.julialang.org/t/laplace-equation-in-one-dimension/67715>\
**Category:** Numerics\
**Tags:** plotting, diffeq, homework\
**Created:** [September 5, 2021, 12:00pm UTC](https://discourse.julialang.org/t/laplace-equation-in-one-dimension/67715 "2021-09-05T12:00:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![raman\_kumar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raman_kumar/32/26782_2.png) [@raman\_kumar](https://discourse.julialang.org/u/raman_kumar)\
**Post date:** [September 5, 2021, 12:00pm UTC](https://discourse.julialang.org/t/laplace-equation-in-one-dimension/67715/1 "2021-09-05T12:00:21Z")

</div>

Please solve the Laplace equation in one dimension on a region bounded between  
x ∈ [0, 1], with the boundary condition Φ(0) = 1, and Φ(1) = 2.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/a/a/aab62396949d93241939bbcfa846ccdd22e7e546.png)

Actually line should pass through (0,1) making 45 degree with x,y-axis.

---

<div class="post-metadata">

**Author:** ![Wen-Wei\_Tseng](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wen-wei_tseng/32/28839_2.png) [@Wen-Wei\_Tseng](https://discourse.julialang.org/u/Wen-Wei_Tseng)\
**Post date:** [September 5, 2021, 12:58pm UTC](https://discourse.julialang.org/t/laplace-equation-in-one-dimension/67715/2 "2021-09-05T12:58:25Z")

</div>

To solve [Laplace’s equation](https://en.wikipedia.org/wiki/Laplace%27s_equation) numerically, a PDE solver is needed. [In this example taken from the ModelingToolkit docs](https://nbviewer.jupyter.org/github/sosiristseng/JuliaExamples/blob/main/modelingtoolkit/04-PDE.ipynb#Stationary-Problems), `ModelingToolkit.jl` was used for symbolic representation and `DiffEqOperators.jl` for finite difference method (FDM).

---

<div class="post-metadata">

**Author:** ![raman\_kumar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raman_kumar/32/26782_2.png) [@raman\_kumar](https://discourse.julialang.org/u/raman_kumar)\
**Post date:** [September 5, 2021, 2:41pm UTC](https://discourse.julialang.org/t/laplace-equation-in-one-dimension/67715/3 "2021-09-05T14:41:59Z")

</div>

i want to solve it without any pde solver. i think it is easy problem.

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [September 5, 2021, 3:16pm UTC](https://discourse.julialang.org/t/laplace-equation-in-one-dimension/67715/4 "2021-09-05T15:16:00Z")

</div>

> [@raman\_kumar](#):
>
> Please solve the Laplace equation

who? you? us? Is this a homework problem? If so:

> [@Homework policy](https://discourse.julialang.org/t/homework-policy/2342):
>
> There have been a few questions in the past few days which are most likely homework. As the language grows, more and more courses will adopt it, so it may be a good idea to formulate some kind of policy that aligns expectations of students looking for help here (and other forums), community members who are willing to help out, and those who just consider this noise. To get the discussion started: I think that asking for help on problem sets is OK, if it is clearly indicated. A homework tag w…

---

<div class="post-metadata">

**Author:** ![zdenek\_hurak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zdenek_hurak/32/53118_2.png) [@zdenek\_hurak](https://discourse.julialang.org/u/zdenek_hurak)\
**Post date:** [September 5, 2021, 5:26pm UTC](https://discourse.julialang.org/t/laplace-equation-in-one-dimension/67715/5 "2021-09-05T17:26:34Z")

</div>

Laplace equations in 1d is not a PDE. Just an ODE with boundary conditions. And a very simple solution.

---

<div class="post-metadata">

**Author:** ![Wen-Wei\_Tseng](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wen-wei_tseng/32/28839_2.png) [@Wen-Wei\_Tseng](https://discourse.julialang.org/u/Wen-Wei_Tseng)\
**Post date:** [September 6, 2021, 2:25am UTC](https://discourse.julialang.org/t/laplace-equation-in-one-dimension/67715/6 "2021-09-06T02:25:55Z")

</div>

@zdenek_hurak You are right. The 1D Laplace equation is a special case with an [easily solvable analytical solution](https://spolanski.github.io/blog/simulation%20journal/1D-Laplace-equation-analytical.html) (a blog by Slawomir Polanski).

@raman_kumar If you are indeed trying to solve your homework, this [video of solving 1D advection and diffusion](https://youtu.be/Xb-iUwXI78A) might give you some ideas.
