<- previous index next ->
Extend PDE solution to complex coefficients and region L31z
Extend PDE solution to complex coefficients and region
Using C++ standard template library #include
and defining a type cmplx typedef complex cmplx;
Global substitute cmplx for double and fix a few varaibles
that must remain double. Fix many formats to print complex (real,imag)
Almost all mathematical algorithms that work with real values,
also work with complex values.
This is just the initial PDE of second order
in three dimensions, in "C", Java, Fortran, Ada
Source code for ".cpp" version, second derivative, two dimensions
nuderiv.hpp compute derivatives
nuderiv.cpp on non uniform grid
simeq.hpp solve simultaneous equations
simeq.cpp with complex coefficients
pde22nu_eq.cpp complex PDE solver
pde22nu_eq_cpp.out solution
The errors were close to the same PDE using just real values.
Commands to compile and run above
g++ -o pde22nu_eq pde22nu_eq.cpp simeq.cpp nuderiv.cpp -lm
pde22nu_eq > pde22nu_eq_cpp.out # writes pde22nu_eq_cpp.out
Source code for java version
Complex.java Complex type and methods
Csimeq.java complex simultaneous equations
Cinvert.java complex matrix inversion
Cnuderiv.java complex non uniform derivative
pdeCnu22_eq.java complex PDE solver
pdeCnu22_eq_java.out solution
The errors were close to the same PDE using just real values.
Commands to compile and run above
javac -cp . Complex.java
javac -cp . Csimeq.java
javac -cp . Cinvert.java
javac -cp . Cnuderiv.java
javac -cp . pdeCnu22_eq.java
java -cp . pdeCnu22_eq > pdeCnu22_eq_java.out # writes pdeCnu22_eq_java.out
Source code for fortran version
The _eq uses C zero based subscripts, the _eq1 used Fortran 1 based subscripts
nuderivC.f90 Complex non uniform derivative
inverseC.f90 Complex matrix inversion
simeqC1.f90 Complex simultaneous equations
pdeCnu22_eq.f90 Complex PDE source code
pdeCnu22_eq_f90.out solution
pdeCnu22_eq1.f90 Complex PDE source code
pdeCnu22_eq1_f90.out solution
Commands to compile and run above
gfortran pdeCnu22_eq.f90 nuderivC.f90 inverseC.f90
a.out > pdeCnu22_eq_f90.out
gfortran pdeCnu22_eq1.f90 nuderivC.f90 inverseC.f90 simeqC1.f90
a.out > pdeCnu22_eq1_f90.out
For more information on Numerical Computation, follow link below:
CMSC 455 Numerical Computation lectures
<- previous index next ->
-
CMSC 455 home page
-
Syllabus - class dates and subjects, homework dates, reading assignments
-
Homework assignments - the details
-
Projects -
-
Partial Lecture Notes, one per WEB page
-
Partial Lecture Notes, one big page for printing
-
Downloadable samples, source and executables
-
Some brief notes on Matlab
-
Some brief notes on Python
-
Some brief notes on Fortran 95
-
Some brief notes on Ada 95
-
An Ada math library (gnatmath95)
-
Finite difference approximations for derivatives
-
MATLAB examples, some ODE, some PDE
-
parallel threads examples
-
Reference pages on Taylor series, identities,
coordinate systems, differential operators
-
selected news related to numerical computation