Solving partial differential equations with the HP Prime and HP 40gs
|
09-04-2023, 12:17 AM
(This post was last modified: 09-04-2023 12:18 AM by Anthony The Koala.)
Post: #1
|
|||
|
|||
Solving partial differential equations with the HP Prime and HP 40gs
I have a PDE with the following criteria:
PDE equation: ∂u/∂t = 0.01 * ∂²u/∂x² initial condition u(x, 0) = 100 for 0 ≤ x ≤ 1 boundary conditions: - For u(0, t) = 0, - For u(1, t) = 200 I have both the HP Prime II and the HP 40gs. I tried searching for solving PDEs on these machines and would like to know how to do it. What is the way to enter the information into these machines? Thank you Anthony, Sydney |
|||
09-04-2023, 09:31 AM
(This post was last modified: 09-04-2023 03:53 PM by carey.)
Post: #2
|
|||
|
|||
RE: Solving partial differential equations with the HP Prime and HP 40gs
Hi Anthony,
While this is a familiar PDE (the 1D heat equation), unlike an ODE that can easily be solved in closed-form, e.g., on the Prime using desolve(), obtaining a complete PDE solution (i.e., solving for functions of both space and time) is not something that can be obtained just by entering a PDE and pressing a button or entering a command...on any handheld calculator that I'm aware of. Two possible directions for a calculator solution are: (i) using Laplace transform CAS features available on both the Prime and the 40GS (though you will need to check if the calculator's laplace functions can handle two variables, i.e., they may only solve ODEs and not PDEs; or (ii) numerical solution of the heat equation setting up a grid and using a finite difference scheme. In the Laplace transform approach, the Laplace transform of u(x,t) gives U(x,s) where time variable t is transformed to the Laplace variable s. Applying the Laplace transform to both sides of this 1D heat equation gives: sU(x,t) - u(x,0)= 0.01 * ∂²U/∂x² (x,s) Applying the initial condition (u(x, 0) = 100) gives: sU(x,t) - 100= 0.01 * ∂²U/∂x² (x,s) Rearranging gives a 2nd order ODE (still in terms of Laplace variable s): ∂²U/∂x² - (s/0.01)U = - 100/0.01 = -10,000 Since this is a 2nd order ODE, perhaps someone familiar with the Prime can say whether it is possible to obtain the following general solution using desolve() (still in Laplace variable s) U(x,s) = A(s) exp(-√(s/0.01x)) + B(s) exp(√(s/0.01x)) - 10000/s At this point, it would become necessary to apply both boundary conditions to the general solution. The resulting equation would then need to be inverse laplace transformed to obtain a solution in terms of time variable t. As the Laplace transform solution approach is simple in principle yet can be complicated in practice, a numerical solution using a grid with initial and boundary conditions and a finite difference scheme for time-stepping can also be considered. The numerical solution can be greatly simplified if only a partial result is needed, e.g., the space solution at a point in time or the time solution at a point in space. |
|||
09-05-2023, 10:59 PM
Post: #3
|
|||
|
|||
RE: Solving partial differential equations with the HP Prime and HP 40gs
While I understand that using the Lapace transform on the original problem transforms the pde into a second order ode then trnsforming the ode back to the original domain to arrive at a solution.
But I want to know what to key in the buttons to solve the problem. Two points (1) I have seen a way to solve a pde for the HP Prime at http://computerlearningservice.com/Acade...Pfunctions But I had trouble assigning the function f(x,y) := on the HP 40GS. (2) Going back to Carey's answer. I wanted to solve the pde using the HP 40GS's LAP to do the Laplace transform then ILAP then use DESOLVE to solve the 2nd order ODE then do an inverse Laplace transform using the HP 40GS's ILAP to revert to the original doman. The documentaion in the HP 40GS manual is lacking in the functions LAP DESOLVE and ILAP. Please assist. Thank you Anthony, Sydney |
|||
09-06-2023, 12:56 AM
Post: #4
|
|||
|
|||
RE: Solving partial differential equations with the HP Prime and HP 40gs
(09-05-2023 10:59 PM)Anthony The Koala Wrote: (1) I have seen a way to solve a pde for the HP Prime at http://computerlearningservice.com/Acade...Pfunctions That link shows how to take a partial derivative (not solve a PDE) on the Prime. Despite the word "partial" that they have in common, taking a "partial" derivative is a different (and far simpler) problem than solving a "partial" differential equation with initial and boundary conditions. (09-05-2023 10:59 PM)Anthony The Koala Wrote: The documentaion in the HP 40GS manual is lacking in the functions LAP DESOLVE As mentioned in my previous post, desolve() is a Prime command, not a 40GS command, and therefore is not found in the 40GS manual. However, LAP and ILAP are found on pages 14-65 through 14-67 of the 40GS manual along with a few ODE examples. Also mentioned in my previous post, these commands "may only solve ODEs and not PDEs" as it appears they work only with 1 independent variable, not 2, and therefore are unlikely to accomplish the PDE to ODE conversion shown in my post. To put things in perspective, XCAS is the Prime's CAS system (more powerful than its predecessor found in the 40GS), and I find no mention of PDEs in the XCAS Reference manual (partial derivatives yes, PDEs no). Hence, while the type of numerical solution I also outlined can be programmed on either calculator, it's doubtful that the goal you stated in the following is possible on any handheld calculator with respect to obtaining a closed-form solution to a PDE with initial and boundary conditions (but would love to be proven wrong!). (09-05-2023 10:59 PM)Anthony The Koala Wrote: But I want to know what to key in the buttons to solve the problem. |
|||
09-06-2023, 04:35 AM
Post: #5
|
|||
|
|||
RE: Solving partial differential equations with the HP Prime and HP 40gs
Dear Carey,
Thank you for the reply. The function desolve does not exist in the HP 40GS. But LAP [b]DESOLVE and ILAP are available. References: pages. 14-65, 14-66 and 14-33 of the user's guide. When attempting to write a pde, one got errors. Conclusion from your information and my experimentaion, the HP 40GS is limited to a one variable equation. Further question: will one be able to do PDEs on the HP Prime? Or is it limited. Thank you Anthony, Sydney |
|||
09-06-2023, 06:38 AM
(This post was last modified: 09-06-2023 06:39 AM by carey.)
Post: #6
|
|||
|
|||
RE: Solving partial differential equations with the HP Prime and HP 40gs
Hi Anthony,
Thank you for the 14-33 page reference in the 40GS manual where DESOLVE (upper-case) is available from the CAS Solve Menu (along with LDEC for linear ODEs with constant coefficients). In retrospect, not surprising since the 40GS and 40G access similar CAS functionality (though in Algebraic mode only) found on the 48Gii/49G/49G+/50G. Since the Prime's CAS is XCAS and the XCAS Reference manual doesn't mention PDEs, PDEs are likely a no-go for the Prime, but I'll defer to those with more experience using the Prime. |
|||
09-12-2023, 12:08 PM
Post: #7
|
|||
|
|||
RE: Solving partial differential equations with the HP Prime and HP 40gs
I am exploring derivatives in the HP Prime.
While this is not solving a pde, I managed to solve a 2nd order ode desolve(4*y''-6*y'+7*y=0) I successfully get G_0*cos(1/4*19^0.5*x) + G_1*sin(1/4*19^0.5*x))*exp(3/4*x) BUT at a later tim I solve the same equation. It now adds the "CAS." before desolve CAS.desolve(4*y''-6*y'+7*y=0) I now get X Error:Syntax Error Why? Thank you Anthony, Sydney |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)