/* ----------[ M a c s y m a ]---------- */ /* ---------- Initialization ---------- */ showtime: all$ prederror: false$ load(ndiff)$ /* ---------- Partial Differential Equations ---------- */ /* This is the heat equation */ heat: 'diff(u, t) - 'diff(u, x, 2) = 0; /* This is the similarity form of the proposed solution */ s: f(x/sqrt(t))/sqrt(t); /* Substitute s into the heat equation */ subst(u = s, heat)$ ev(%, diff); /* Change to the similarity variable z = x/sqrt(t) */ subst(x = z*sqrt(t), %); /* Combine over a common denominator */ ratsimp(%); /* Eliminate the denominator */ % * denom(lhs(%)); /* Rewrite the differential equation in MACSYMA's normal notation */ convert_to_de(%); /* Now, solve the ordinary differential equation */ ode2(%, f(z), z); /* Finally, transform back to the original variables */ 's = subst(x/sqrt(t), z, rhs(%))/sqrt(t); /* If we set %k1 = 0 and %k2 = 1/(2 sqrt(pi)) in the previous expression, we will obtain the usual fundamental solution of the heat equation */ subst([%k1 = 0, %k2 = 1/(2*sqrt(%pi))], %); /* ---------- Quit ---------- */ quit();