janhardo

955 Reputation

13 Badges

12 years, 45 days
B. Ed math

MaplePrimes Activity


These are replies submitted by janhardo

foo := proc(params)
local b,c,d;

b := rhs(params[1]);
c := rhs(params[2]);
d := rhs(params[3]);

print(b,c,d);

end proc;

foo([b = 2, c = 3, d = 4]);
foo([b = 2, c = 3, d = 4]);
                            2, 3, 4

                            2, 3, 4

Once the procedure has finished, these local variables are no longer in use.
No global assignments were made.

Therefore, the second call is exactly the same as the first:

 

@C_R 
Maple packages are also modules, and since you can store many procedures in them, you have everything in a single package.
If the module becomes large and slows down the worksheet, you can turn it into a library, and it will work again without any delay.

You can then create a module for the 1D PDEs that I’ve already started working on.
These are truly general solutions, and the code has already been adapted for numerical values of the parameters so that plots can be generated.

I still need to further improve the module code to display all test cases as general solutions and numerically with a plot.
The numerical PDE lends itself well to testing whether it satisfies the PDE.

Of course, everything can be done in even greater detail with units, but follow the methodology of the org.2000 approach to clarify the calculation method.

Then you’ll be following a physicist’s approach when you incorporate units, and I assume you’ll be using the SI system of units.

 

 

Problem 200 is the same problem here solved partly by @Rouben Rostamian  
The module code must be corrected , because it is not a Neumann Boundry Condition, but Dirichlet BC
Also problematic to get a 3D plot and animation.

 

@C_R 

 

3.1 Diffusion in 1D

 

https://www.12000.org/my_notes/pde_in_CAS/maple_2026_1_and_mma_15/indexsubsection156.htm#x181-1800003.1.1

restart;

HeatPDE := module()

option package;

uses plots, plottools, PDEtools;

export
    Problem,
    Solution,
    ShowProblem,
    AnalyzeProblem,
    PlotTitle,
    PDEPlot,
    SolveProblem,
    ShowSolution,
    RunProblem;

    (* -----------------------------------------------------------------
       Probleemdefinitie
       ----------------------------------------------------------------- *)
    Problem := proc()
    module()
    option object;
    export
        Title,
        PDE,
        BC,
        IC,
        Domain,
        PDEType,
        BCType,
        DomainType,
        ICType,
        Assumptions;
    end module;
    end proc;

    (* -----------------------------------------------------------------
       Oplossingsobject
       ----------------------------------------------------------------- *)
    Solution := proc()
    module()
    option object;
    export
        Solution,
        Method,
        MapleCall,
        Verified,
        CPUTime,
        Warnings;
    end module;
    end proc;

    (* -----------------------------------------------------------------
       Toon probleemgegevens
       ----------------------------------------------------------------- *)
    ShowProblem := proc(P)
        printf("Titel: %a\n", P:-Title);
        printf("PDE : %a\n", P:-PDE);
        printf("BC  : %a\n", P:-BC);
        printf("IC  : %a\n", P:-IC);
        printf("Domein: %a\n", P:-Domain);
        if assigned(P:-Assumptions) then
            printf("Aannames: %a\n", P:-Assumptions);
        end if;
        NULL;
    end proc;

    (* -----------------------------------------------------------------
       Analyse
       ----------------------------------------------------------------- *)
    AnalyzeProblem := proc(P)
        local R, ICrhs;

        R := rhs(P:-PDE);
        if has(R, diff(u(x,t), x$2)) then
            P:-PDEType := "Diffusie";
        else
            P:-PDEType := "Onbekend";
        end if;

        if type(P:-BC, list) and nops(P:-BC) = 2 then
            if has(lhs(P:-BC[1]), diff) or has(lhs(P:-BC[1]), D) or
               has(lhs(P:-BC[2]), diff) or has(lhs(P:-BC[2]), D) then
                P:-BCType := "Neumann-randvoorwaarden";
            else
                if rhs(P:-BC[1]) = 0 and rhs(P:-BC[2]) = 0 then
                    P:-BCType := "Dirichlet-randvoorwaarden (homogeen)";
                else
                    P:-BCType := "Dirichlet-randvoorwaarden (niet-homogeen)";
                end if;
            end if;
        else
            P:-BCType := "Algemene randvoorwaarden";
        end if;

        P:-DomainType := "Eindig interval";

        ICrhs := rhs(P:-IC);
        if type(ICrhs, 'function') or has(ICrhs, function) then
            P:-ICType := "Algemene functie";
        else
            P:-ICType := "Constante of eenvoudige uitdrukking";
        end if;

        NULL;
    end proc;

    (* -----------------------------------------------------------------
       Titel voor de plot – met PDEtools:-declare voor mooie notatie
       ----------------------------------------------------------------- *)
    PlotTitle := proc(P)
        local u, x, t, k, L;
        # declareer u(x,t) met afgeleide-notatie (u_t, u_xx)
        PDEtools:-declare(u(x,t), prime=t);
        # Gebruik de opgemaakte uitdrukkingen
        return typeset(P:-IC, "\n", P:-PDE);
    end proc;

    (* -----------------------------------------------------------------
       Schematische plot van het probleem
       ----------------------------------------------------------------- *)
    PDEPlot := proc(P)
        local ttl, bc1_str, bc2_str, Lval;

        AnalyzeProblem(P);
        ttl := PlotTitle(P);

        bc1_str := convert(P:-BC[1], string);
        bc2_str := convert(P:-BC[2], string);

        # Haal de rechtergrens uit Domain, of gebruik 'L' als symbool
        if type(P:-Domain, list) and nops(P:-Domain) = 2 then
            Lval := P:-Domain[2];
        else
            Lval := 'L';
        end if;

        plots:-display(
            plottools:-rectangle([0,-1], [10,1], color=white, linestyle=solid),
            plottools:-line([2,0], [8,0], thickness=3, color=black),
            plottools:-point([2,0], symbol=solidcircle, symbolsize=16, color=red),
            plottools:-point([8,0], symbol=solidcircle, symbolsize=16, color=red),
            plots:-textplot([2, -0.3, bc1_str], align={above, right}, font=[TIMES,12]),
            plots:-textplot([8, -0.3, bc2_str], align={above, left}, font=[TIMES,12]),
            plots:-textplot([2, -0.7, P:-BCType], align={above, right}, font=[TIMES,10, ITALIC]),
            plots:-textplot([8, -0.7, P:-BCType], align={above, left}, font=[TIMES,10, ITALIC]),
            plots:-textplot([2, 0.15, "0"], align={below}, font=[TIMES,12]),
            plots:-textplot([8, 0.15, sprintf("%a", Lval)], align={below}, font=[TIMES,12]),
            title = ttl,
            titlefont = [TIMES, BOLD, 14],
            axes = none,
            size = [900, 300],
            scaling = constrained
        );
    end proc;

    (* -----------------------------------------------------------------
       Oplossen met pdsolve
       ----------------------------------------------------------------- *)
    SolveProblem := proc(P)
        local eqs, sol, S;

        eqs := [P:-PDE, P:-IC, op(P:-BC)];

        if assigned(P:-Assumptions) then
            sol := pdsolve(eqs, u(x,t), output=realtime) assuming op(P:-Assumptions);
        else
            sol := pdsolve(eqs, u(x,t), output=realtime);
        end if;

        S := Solution();
        S:-Solution := sol;
        S:-Method   := "pdsolve";
        S:-MapleCall:= "pdsolve(... output=realtime)";
        S:-Verified := "Niet geverifieerd";
        S:-CPUTime  := "Niet gemeten";
        S:-Warnings := "";

        return S;
    end proc;

    (* -----------------------------------------------------------------
       Toon oplossing
       ----------------------------------------------------------------- *)
    ShowSolution := proc(S)
        print(S:-Solution);
        NULL;
    end proc;

    (* -----------------------------------------------------------------
       Volledige run – plot wordt zichtbaar
       ----------------------------------------------------------------- *)
    RunProblem := proc(P)
        local S;
        ShowProblem(P);
        AnalyzeProblem(P);
        print(PDEPlot(P));
        S := SolveProblem(P);
        ShowSolution(S);
        return S;
    end proc;

end module:

 

 

with(HeatPDE):

P := Problem();
P:-Title := "Problem 151 - constante beginvoorwaarde";
P:-PDE   := diff(u(x,t), t) = (1/100)*diff(u(x,t), x$2);
P:-BC    := [u(0,t)=0, u(10,t)=0];
P:-IC    := u(x,0)=100;
P:-Domain:= [0,10];
P:-Assumptions := [];

S := RunProblem(P);

# 3D‑plot: standaard tot t=5
PlotSolution(S, P);

# Met fijnere resolutie en andere eindtijd
PlotSolution(S, P, T=10, gridpts=100);

_m2061121821120

 

"Problem 151 - constante beginvoorwaarde"

 

diff(u(x, t), t) = (1/100)*(diff(diff(u(x, t), x), x))

 

[u(0, t) = 0, u(10, t) = 0]

 

u(x, 0) = 100

 

[0, 10]

 

[]

 

Titel: "Problem 151 - constante beginvoorwaarde"
PDE : diff(u(x,t),t) = 1/100*diff(diff(u(x,t),x),x)
BC  : [u(0,t) = 0, u(10,t) = 0]
IC  : u(x,0) = 100
Domein: [0, 10]
Aannames: []

 

u(x, t)*`will now be displayed as`*u

 

`derivatives with respect to`*t*`of functions of one variable will now be displayed with '`

 

 

u(x, t) = Sum(-200*((-1)^n-1)*sin((1/10)*n*Pi*x)*exp(-(1/10000)*Pi^2*n^2*t)/(n*Pi), n = 1 .. infinity)

 

_m2061155048096

 

PlotSolution(_m2061155048096, _m2061121821120)

 

PlotSolution(_m2061155048096, _m2061121821120, T = 10, gridpts = 100)

(1.1)

 

probleem 150

 

with(HeatPDE);

P := Problem():
P:-Title := "Problem 150":
P:-PDE   := diff(u(x,t), t) = k * diff(u(x,t), x$2):
P:-BC    := [u(0,t) = 0, u(L,t) = 0]:
P:-IC    := u(x,0) = f(x):
P:-Domain:= [0, L]:
P:-Assumptions := [k > 0, L > 0]:

# Voer alles uit
S := RunProblem(P):

# Nu kun je met P en S verder werken
printf("Gebruikte methode: %a\n", S:-Method);
oplossing := S:-Solution;

[AnalyzeProblem, PDEPlot, PlotTitle, Problem, RunProblem, ShowProblem, ShowSolution, Solution, SolveProblem]

 

Titel: "Problem 150"
PDE : diff(u(x,t),t) = k*diff(diff(u(x,t),x),x)
BC  : [u(0,t) = 0, u(L,t) = 0]
IC  : u(x,0) = f(x)
Domein: [0, L]
Aannames: [0 < k, 0 < L]

 

u(x, t)*`will now be displayed as`*u

 

`derivatives with respect to`*t*`of functions of one variable will now be displayed with '`

 

 

u(x, t) = Sum(2*sin(n*Pi*x/L)*exp(-k*Pi^2*n^2*t/L^2)*(Int(f(x)*sin(n*Pi*x/L), x = 0 .. L))/L, n = 1 .. infinity)

 

Gebruikte methode: "pdsolve"

 

u(x, t) = Sum(2*sin(n*Pi*x/L)*exp(-k*Pi^2*n^2*t/L^2)*(Int(f(x)*sin(n*Pi*x/L), x = 0 .. L))/L, n = 1 .. infinity)

(2.1)

 

probleem 151

 

# 1. Laad de module (als die nog niet geladen is)
with(HeatPDE);

# 2. Maak een nieuw probleemobject
P := Problem():

# 3. Vul de gegevens in volgens de opgave
P:-Title := "Problem 151 - Warmtegeleiding met constante beginvoorwaarde":
P:-PDE   := diff(u(x,t), t) = (1/100) * diff(u(x,t), x$2):   # k = 1/100
P:-BC    := [u(0,t) = 0, u(10,t) = 0]:                       # L = 10
P:-IC    := u(x,0) = 100:                                    # f(x) = 100
P:-Domain:= [0, 10]:                                         # L = 10
P:-Assumptions := []:                                        # Geen extra aannames nodig

# 4. Voer de volledige analyse, plot en oplossing uit
S := RunProblem(P):

[AnalyzeProblem, PDEPlot, PlotTitle, Problem, RunProblem, ShowProblem, ShowSolution, Solution, SolveProblem]

 

Titel: "Problem 151 - Warmtegeleiding met constante beginvoorwaarde"
PDE : diff(u(x,t),t) = 1/100*diff(diff(u(x,t),x),x)
BC  : [u(0,t) = 0, u(10,t) = 0]
IC  : u(x,0) = 100
Domein: [0, 10]
Aannames: []

 

u(x, t)*`will now be displayed as`*u

 

`derivatives with respect to`*t*`of functions of one variable will now be displayed with '`

 

 

u(x, t) = Sum(-200*((-1)^n-1)*sin((1/10)*n*Pi*x)*exp(-(1/10000)*Pi^2*n^2*t)/(n*Pi), n = 1 .. infinity)

(3.1)

 

probleem 152

 

 

# 1. Laad de module (als die nog niet geladen is)
with(HeatPDE):

# 2. Maak een nieuw probleemobject
P := Problem():

# 3. Vul de gegevens in volgens de opgave
P:-Title := "Problem 152 - Beginvoorwaarde u = x(1-x)":
P:-PDE   := diff(u(x,t), t) = (1/100) * diff(u(x,t), x$2):   # k = 1/100
P:-BC    := [u(0,t) = 0, u(1,t) = 0]:                       # L = 1
P:-IC    := u(x,0) = x*(1-x):                               # f(x) = x(1-x)
P:-Domain:= [0, 1]:                                         # L = 1
P:-Assumptions := []:                                       # Geen extra aannames

# 4. Voer de volledige analyse, plot en oplossing uit
S := RunProblem(P):

Titel: "Problem 152 - Beginvoorwaarde u = x(1-x)"
PDE : diff(u(x,t),t) = 1/100*diff(diff(u(x,t),x),x)
BC  : [u(0,t) = 0, u(1,t) = 0]
IC  : u(x,0) = x*(1-x)
Domein: [0, 1]
Aannames: []

 

u(x, t)*`will now be displayed as`*u

 

`derivatives with respect to`*t*`of functions of one variable will now be displayed with '`

 

 

u(x, t) = Sum(-4*((-1)^n-1)*sin(n*Pi*x)*exp(-(1/100)*Pi^2*n^2*t)/(n^3*Pi^3), n = 1 .. infinity)

(4.1)

 

probleem 153

 

# 1. Laad de module (als die nog niet geladen is)
with(HeatPDE):

# 2. Maak een nieuw probleemobject
P := Problem():

# 3. Vul de gegevens in volgens de opgave
P:-Title := "Problem 153 - Haberman 2.3.3 (a)":
P:-PDE   := diff(u(x,t), t) = k * diff(u(x,t), x$2):   # algemene diffusiecoëfficiënt k
P:-BC    := [u(0,t) = 0, u(L,t) = 0]:                 # homogene Dirichlet
P:-IC    := u(x,0) = 6 * sin(9*Pi*x/L):               # specifieke beginvoorwaarde
P:-Domain:= [0, L]:                                   # lengte L (symbool)
P:-Assumptions := [k > 0, L > 0]:                     # fysische aannames voor pdsolve

# 4. Voer de volledige analyse, plot en oplossing uit
S := RunProblem(P):

Titel: "Problem 153 - Haberman 2.3.3 (a)"
PDE : diff(u(x,t),t) = k*diff(diff(u(x,t),x),x)
BC  : [u(0,t) = 0, u(L,t) = 0]
IC  : u(x,0) = 6*sin(9*Pi*x/L)
Domein: [0, L]
Aannames: [0 < k, 0 < L]

 

u(x, t)*`will now be displayed as`*u

 

`derivatives with respect to`*t*`of functions of one variable will now be displayed with '`

 

 

u(x, t) = 6*sin(9*Pi*x/L)*exp(-81*k*Pi^2*t/L^2)

(5.1)

 

probleem 160

 

# 1. Laad de module (als die nog niet geladen is)
with(HeatPDE):

# 2. Maak een nieuw probleemobject
P := Problem():

# 3. Vul de gegevens in volgens de opgave
P:-Title := "Problem 160 - Warmte met bronterm Q(x) (algemeen)":
P:-PDE   := diff(u(x,t), t) = k * diff(u(x,t), x$2) + Q(x):   # inhomogene PDE
P:-BC    := [u(0,t) = 0, u(L,t) = 0]:                         # homogene Dirichlet
P:-IC    := u(x,0) = f(x):                                    # algemene beginvoorwaarde
P:-Domain:= [0, L]:                                           # lengte L (symbool)
P:-Assumptions := [k > 0, L > 0]:                             # fysische aannames

# 4. Voer de volledige analyse, plot en oplossing uit
S := RunProblem(P):

Titel: "Problem 160 - Warmte met bronterm Q(x) (algemeen)"
PDE : diff(u(x,t),t) = k*diff(diff(u(x,t),x),x)+Q(x)
BC  : [u(0,t) = 0, u(L,t) = 0]
IC  : u(x,0) = f(x)
Domein: [0, L]
Aannames: [0 < k, 0 < L]

 

u(x, t)*`will now be displayed as`*u

 

`derivatives with respect to`*t*`of functions of one variable will now be displayed with '`

 

 

u(x, t) = (-(Int(Int(Q(_a), _a = 0 .. _a), _a = 0 .. x))*L^2+(Int(Int(Q(_z1), _z1 = 0 .. _z1), _z1 = 0 .. L))*x*L+2*(Sum(sin(n*Pi*x/L)*exp(-k*Pi^2*n^2*t/L^2)*(Int((f(_a)*L*k+(Int(Int(Q(_z1), _z1 = 0 .. _z1), _z1 = 0 .. _a))*L-(Int(Int(Q(_z1), _z1 = 0 .. _z1), _z1 = 0 .. L))*_a)*sin(n*Pi*_a/L), _a = 0 .. L)), n = 1 .. infinity)))/(k*L^2)

(6.1)

 

 

 

problem 196

 

# 1. Laad de module (als die nog niet geladen is)
with(HeatPDE):

# 2. Maak een nieuw probleemobject
P := Problem():

# 3. Vul de gegevens in volgens de opgave
P:-Title := "Problem 196 - Gemengde (Robin) randvoorwaarden":
P:-PDE   := diff(u(x,t), t) = k * diff(u(x,t), x$2);
P:-BC    := [
    D[1](u)(0,t) + u(0,t) = 0,          # Robin BC aan linkerzijde
    D[1](u)(L,t) + u(L,t) = 0           # Robin BC aan rechterzijde
]:
P:-IC    := u(x,0) = f(x):
P:-Domain:= [0, L]:
P:-Assumptions := [k > 0, L > 0]:

# 4. Voer de volledige analyse, plot en oplossing uit
S := RunProblem(P):

diff(u(x, t), t) = k*(diff(diff(u(x, t), x), x))

 

Titel: "Problem 196 - Gemengde (Robin) randvoorwaarden"
PDE : diff(u(x,t),t) = k*diff(diff(u(x,t),x),x)
BC  : [D[1](u)(0,t)+u(0,t) = 0, D[1](u)(L,t)+u(L,t) = 0]
IC  : u(x,0) = f(x)
Domein: [0, L]
Aannames: [0 < k, 0 < L]

 

u(x, t)*`will now be displayed as`*u

 

`derivatives with respect to`*t*`of functions of one variable will now be displayed with '`

 

 

u(x, t) = Sum(2*(-Pi*n*cos(n*Pi*x/L)+sin(n*Pi*x/L)*L)*exp(-k*Pi^2*n^2*t/L^2)*(Int(f(x)*(-Pi*n*cos(n*Pi*x/L)+sin(n*Pi*x/L)*L), x = 0 .. L))/(L*(Pi^2*n^2+L^2)), n = 1 .. infinity)

(7.1)

 

problem 167

 

# 1. Laad de module (als die nog niet geladen is)
with(HeatPDE):

# 2. Maak een nieuw probleemobject
P := Problem():

# 3. Vul de gegevens in volgens de opgave
P:-Title := "Problem 167 - Variabele coëfficiënten: u_t = x^2 u_xx + x u_x":
P:-PDE   := diff(u(x,t), t) = x^2 * diff(u(x,t), x$2) + x * diff(u(x,t), x):
P:-BC    := [u(1,t) = 0, u(b,t) = 0]:
P:-IC    := u(x,0) = f(x):
P:-Domain:= [1, b]:
P:-Assumptions := [b > 1]:   # x in (1,b), dus positief, en b>1

# 4. Voer de volledige analyse, plot en oplossing uit
S := RunProblem(P):

Titel: "Problem 167 - Variabele coëfficiënten: u_t = x^2 u_xx + x u_x"
PDE : diff(u(x,t),t) = x^2*diff(diff(u(x,t),x),x)+x*diff(u(x,t),x)
BC  : [u(1,t) = 0, u(b,t) = 0]
IC  : u(x,0) = f(x)
Domein: [1, b]
Aannames: [1 < b]

 

u(x, t)*`will now be displayed as`*u

 

`derivatives with respect to`*t*`of functions of one variable will now be displayed with '`

 

 

u(x, t) = 2*(Sum(sin(n*Pi*ln(x)/ln(b))*exp(-Pi^2*n^2*t/ln(b)^2)*(Int(f(x)*sin(n*Pi*ln(x)/ln(b))/x, x = 1 .. b)), n = 1 .. infinity))/ln(b)

(8.1)

 

 

Voorbeeld: Problem 200 – Warmteflux aan één uiteinde

 


with(HeatPDE):

# ===================================================================
# 1. Definieer het probleem
# ===================================================================
P := Problem():

P:-Title := "Problem 200 - Warmteflux aan linkerzijde":
P:-PDE   := diff(u(x,t), t) = k * diff(u(x,t), x$2):
# Randvoorwaarden:
#   -k * u_x(0,t) = q0   (warmteflux)  =>  u_x(0,t) = -q0/k
#   u(L,t) = 0
P:-BC    := [D[1](u)(0,t) = -q0/k, u(L,t) = 0]:
# Beginvoorwaarde: staaf is aanvankelijk op temperatuur 0
P:-IC    := u(x,0) = 0:
P:-Domain:= [0, L]:
P:-Assumptions := [k > 0, L > 0, q0 > 0]:

# ===================================================================
# 2. Los op en toon resultaten
# ===================================================================
S := RunProblem(P):

Titel: "Problem 200 - Warmteflux aan linkerzijde"
PDE : diff(u(x,t),t) = k*diff(diff(u(x,t),x),x)
BC  : [D[1](u)(0,t) = -q0/k, u(L,t) = 0]
IC  : u(x,0) = 0
Domein: [0, L]
Aannames: [0 < k, 0 < L, 0 < q0]

 

u(x, t)*`will now be displayed as`*u

 

`derivatives with respect to`*t*`of functions of one variable will now be displayed with '`

 

 

u(x, t) = q0*(-8*L*(Sum(cos((1/2)*(1+2*n)*Pi*x/L)*exp(-(1/4)*k*Pi^2*(1+2*n)^2*t/L^2)/(1+2*n)^2, n = 0 .. infinity))/Pi^2+L-x)/k

(9.1)

 


 

Download 1D_warmte_pde_met_voorbeelden_31-7-2026.mw

@ianmccr
Thanks for the extensibve answer, very useful.
I asked chatgpt something:

My expectation

For someone developing a large Maple library, I expect that ChatGPT combined with Maple MCP will ultimately be more powerful than the current built-in Maple AI. ChatGPT is better suited to assisting with software architecture, library design, refactoring, documentation, and explaining complex algorithms, while Maple, through MCP, performs the symbolic and numerical computations, executes the code, and verifies its correctness.

That said, the overall experience will depend on how extensively the Maple MCP server exposes the active Maple session and worksheet to ChatGPT. This is an implementation detail that Maplesoft will need to document more thoroughly as the Maple MCP platform continues to evolve.

You'll need two subscriptions:
- I'm currently using the cheapest ChatGPT plan: “Go”
- The second subscription is with Maplesoft, and you can also choose a package for the Maple Elite Maintenance Program there, depending on your AI usage (just like with ChatGPT, where you can also choose a package)

@Rouben Rostamian  
Amazing work 

@C_R 
Some answers :-) 
1) Did not check it , so ? 
2) Must be possible , a procedure is a general approach.
Because the module code can answering different experiments , it must be  general coded, otherwise you can do only one experiment if it is not general coded.
Every new experiment code example must be hardcoded with new data.if you don't use procedures.
3) Possible, but needs more time, there is the known start example and all other examples  are variants with different boundaries
4) ChatGpt paid plus ( cheaper one possible , i think ) now with  GPT plugin : mathematical statistics ( makes those posters) 
5) BC4  is there for the mathematival completeness, but has no influence i think on the calculation

It’s important to be able to define the boundary regions.
This module code can be expanded even further to heat or cool the rod in different ways (that’s also possible)
I put this module code together quickly, so there may well be some errors in it.

I've encountered nonlinear PDEs before that require different solution techniques, but I also find this linear PDE for heat to be complicated

Rod with different boundries conditions
staaf_module_met_wisselnde_boundriesDEFvoorlopig_18-7-2026.mw

corrected rod boundry conditions 

 

 

   


Formal double-series solution:

 

T(r, z, t) = Sum(Sum(piecewise(n = 0, 1, 2)*alpha*(Int(2*exp(-alpha*(BesselJZeros(0, m)^2/a^2+n^2*Pi^2/L^2)*(t-s))*(Int(r*q(r, s)*BesselJ(0, BesselJZeros(0, m)*r/a), r = 0 .. a))/(a^2*BesselJ(1, BesselJZeros(0, m))^2), s = 0 .. t))*BesselJ(0, BesselJZeros(0, m)*r/a)*piecewise(n = 0, 1, cos(n*Pi*z/L))/(K*L), n = 0 .. infinity), m = 1 .. infinity)

 


Corner compatibility check q(a,t): 0
Initial flux compatibility check q(r,0): 0

Series solution for q(r,t)=q0*(1-(r/a)^2)*sin(omega*t):

 

T(r, z, t) = Sum(Sum(2*piecewise(n = 0, 1, 2)*alpha*q0*(Int(r*(a^2-r^2)*BesselJ(0, BesselJZeros(0, m)*r/a), r = 0 .. a))*(alpha*(BesselJZeros(0, m)^2/a^2+n^2*Pi^2/L^2)*sin(omega*t)-omega*cos(omega*t)+omega*exp(-alpha*(BesselJZeros(0, m)^2/a^2+n^2*Pi^2/L^2)*t))*BesselJ(0, BesselJZeros(0, m)*r/a)*piecewise(n = 0, 1, cos(n*Pi*z/L))/(K*L*a^4*BesselJ(1, BesselJZeros(0, m))^2*(alpha^2*(BesselJZeros(0, m)^2/a^2+n^2*Pi^2/L^2)^2+omega^2)), n = 0 .. infinity), m = 1 .. infinity)

 


Numerical q(a,t) check at t=1: 0
Initial temperature check T(r,z,0): 0
Outer-wall check T(a,z,t): -4.20561e-15
Sample temperature T(0.2,0.7,1): 2.20970e-05

 

 

 


Convergence study at r=0.2, z=0.7, t=1
      M       N              T_MN
      5       8      7.449060185e-06
      8      12      8.754690157e-05
     12      18      9.439198208e-05
     15      25      2.209696623e-05
     20      35      9.187070509e-05

Worksheet completed successfully.

 
 

 

Download pde_heat_1D_oplossing_van_mprimes_misschien_correctie_17-7-2026.mw

boundry conditions for this rod setup 

@Rouben Rostamian  
Thanks for pointing this out
I'm not entirely sure what you mean exactly, but got a idea of it 
Yes, i am interested in the details of this setup 

https://www.dropbox.com/scl/fi/cuexecaf3x4wd5vwi28gv/pde-warmet-cilindrische-staaf.png?rlkey=9gob68msfpsdbksuemcxtwtiz&st=t6d7q09s&dl=0

 

restart:

infolevel[pdsolve] := 3:

assume(k > 0, L > 0):

PDE1D :=
    diff(V(z,t),t)
    =
    k*diff(V(z,t),z$2):

BC1 :=
    -k*D[1](V)(0,t)
    =
    q(t):

BC2 :=
    D[1](V)(L,t)
    =
    0:

IC :=
    V(z,0)
    =
    0:

problem1D := {PDE1D, BC1, BC2, IC}:

sol1D := pdsolve(
    problem1D,
    V(z,t)

This seems the right conditions for this experiment?

BC1 := -k*D[2](T)(r,0,t) = q(t);
BC2 := D[2](T)(r,L,t) = 0;
BC3 := D[1](T)(R,z,t) = 0;
BC4 := D[1](T)(0,z,t) = 0;
IC  := T(r,z,0) = 0;

@Earl 
Hello Earl , the display command ends with : (surpressing outcome),  use  ;  

1 2 3 4 5 6 7 Last Page 1 of 89