Course Test · University: upper level
Partial differential equations: RatMath answers
The same twenty exercises, answered with RatMath Core and the Shelf libraries only. The code below was run when this page was built; its output is shown as printed, and compared with the independent answer.
Agrees 20
Libraries used here: core, analytic, symbolic. In this code each library is in scope under its own name (linalg.det, stats.tTest), and Core's names (R, Rational, …) are in scope directly.
- 1.ClassificationAgreesClassify as elliptic, parabolic or hyperbolic.Independent answer: hyperbolic.RatMath code
const c = analytic.pde.classify({ A: 1, B: 4, C: 3 }); [c.discriminant, c.type]Output["4", "hyperbolic"]
pde.classifytakes the sign of ; with coefficients in and it returns the region of each type.Fix: ratmath/analytic#19,termsForError,newton(..., { exact: true }),darboux,pde.classify,gradientDescent - 2.CharacteristicsAgreesSolve with , and find .Independent answeris constant on the lines , so and .RatMath code
const u = analytic.pde.transport({ speed: 2, initial: "exp(-x^2)" }); [u.formula, u.characteristics, u.at(1, "1/2").value]Output["exp(-(x - 2*t)^2)", "x - 2*t = const", 1]
pde.transportsolves along characteristics: here a closed formula, and the value at the point is exactly 1 because the foot of the characteristic is . With a speed that depends on it reports the breaking time and refuses past it.Fix: ratmath/analytic#20,nFor,deltaForandverifyCertificate;supremum,limsup,liminf; limits of ; uniform convergence decided both ways;pde.transport; exact finite-mode Laplace solutions - 3.Heat equation, fixed endsAgreesA rod with , ends held at 0, starts at . Find .Independent answerfor odd , so ; at the point, .RatMath code
analytic.heat({ k: 1, length: 1, initial: "x*(1 - x)", terms: 8 }).at("1/2", "1/10").valueOutput0.0961618714341978422:0.09616187143494386749
- 4.Fourier sine coefficientsAgreesFor the same rod, what is the first coefficient of the sine series?Independent answer.RatMath code
analytic.heat({ k: 1, length: 1, initial: "x*(1 - x)" }).modes[0].coefficientOutput0.2580122754652123854:0.25801227546718121957
- 5.Decay ratesAgreesFor on with fixed ends, at what rate does the slowest mode decay?Independent answer.RatMath code
analytic.heat({ k: 2, length: 3, initial: "x*(3 - x)" }).modes[0].rateOutput2*(pi/3)^2
- 6.Heat equation, insulated endsAgreesA rod with insulated ends starts at . Find , and the temperature it tends to.Independent answerCosine series: . So , tending to the mean, .RatMath code
analytic.heat({ length: 1, initial: "x", ends: "insulated" }).at(0, 1).valueOutput0.4999790373822083[0213:2744]
- 7.Wave equation, d'AlembertAgreesA string with starts at rest in the shape . Find .Independent answer, so .RatMath code
analytic.wave({ c: 1, length: 1, position: "sin(pi*x)" }).at("1/4", "1/3")Output0.3535533905932737622:0.35355339059327376221
- 8.Periodicity of a stringAgreesA plucked string , , starts at rest as . Compare with .Independent answerThe motion has period , so both are .RatMath code
const s = analytic.wave({ c: 1, length: 1, position: "x*(1 - x)" }); [s.at("1/3", 2), s.at("1/3", 0)]Output[2/9, 2/9]
- 9.Waves on a lineAgreesOn the whole line, with and . Find .Independent answer, so .RatMath code
analytic.wave({ c: 1, position: "exp(-x^2)" }).at(3, 3)Output0.5000000000000001159[7:8]
- 10.Initial velocityAgreesOn the whole line, with and . Find .Independent answer, so .RatMath code
analytic.wave({ c: 1, position: "0", velocity: "1/(1 + x^2)" }).at(0, 1)Output0.785398163397[10379986:79262657]
- 11.Laplace on a rectangleAgreesSolve on the unit square with on the top edge and 0 on the other three. Find .Independent answer, so .RatMath code
analytic.laplaceRectangle({ top: "sin(pi*x)", terms: 16 }).at("1/2", "1/2").valueOutput0.1992684076691933402[1:2]
The tail bound does not know that only one mode is present, so 16 terms are needed for a tight enclosure: with 4 terms it is about 0.002 wide. - 12.Mean value propertyAgreesA disc of radius 1 has its rim held at . What is the steady temperature at the centre?Independent answerThe mean of the boundary values: .RatMath code
analytic.laplaceDisc({ boundary: "cos(theta)^2", terms: 4 }).meanOutput1/2
- 13.Laplace on a discAgreesFor the same disc, find at , .Independent answer, so and .RatMath code
analytic.laplaceDisc({ boundary: "cos(theta)^2", terms: 32 }).at("1/2", 0).valueOutput5/8
The answer is exact after two terms, but the tail bound shrinks only like : with 4 terms the enclosure is , with 32 it is within . Thepartialfield holds the kept terms alone. - 14.Sturm–Liouville eigenvaluesAgreesFind the first two eigenvalues of , .Independent answer: and .RatMath code
analytic.sturmLiouville({ interval: [0, 1], count: 2 }).map((e) => e.eigenvalue)Output[9869603901/1000000000:9869604901/1000000000, 2467401069/62500000:4934802263/125000000]
- 15.Eigenvalues on a longer intervalAgreesFind the lowest eigenvalue of , .Independent answer.RatMath code
analytic.sturmLiouville({ interval: [0, 2], count: 1 })[0].eigenvalueOutput12337003/5000000:771063/312500
- 16.Heat on a lineAgreesOn the whole line, with . Find .Independent answer, so .RatMath code
analytic.heatLine({ initial: "exp(-x^2)" }).at(1, "1/2")Output0.4136895450425679529:0.41368954504257877051
- 17.Conservation of heatAgreesFor the same problem, show that the total heat does not change, and find it.Independent answer, so it stays .RatMath code
analytic.heatLine({ initial: "exp(-x^2)" }).heat()Output1.77245385090551[432259:858168]
- 18.Steady state with a sourceAgreesFind the steady temperature of a rod with a uniform heat source, , , at the midpoint.Independent answer, so .RatMath code
analytic.bvp({ f: "-1", interval: [0, 1], left: { y: 0 }, right: { y: 0 }, digits: 15 }).exact().at("1/2")Output0.12[49999999999475:50000000000475]
- 19.Expanding a constantAgreesA rod at temperature 1 has its ends plunged into ice. What is the first coefficient of its sine series on ?Independent answer, so .RatMath code
analytic.heat({ initial: "1" }).modes[0].coefficientOutput1.273239544735[14738003:25132866]
- 20.Checking a separated solutionAgreesShow that solves .Independent answerand , so .RatMath code
const u = "exp(-t)*sin(x)"; const D = (e, v) => symbolic.format(symbolic.differentiate(symbolic.parse(e), v)); const ut = D(u, "t"), uxx = D(D(u, "x"), "x"); PRINT("u_t =", ut, " u_xx =", uxx); String(symbolic.simplify(`(${ut}) - (${uxx})`))Output0