laplace.rlg 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810
  1. Mon Jan 4 00:04:24 MET 1999
  2. REDUCE 3.7, 15-Jan-99 ...
  3. 1: 1:
  4. 2: 2: 2: 2: 2: 2: 2: 2: 2:
  5. 3: 3: % Title: Examples of Laplace Transforms.
  6. % Author: L. Kazasov.
  7. % Date: 24 October 1988.
  8. order p;
  9. % Elementary functions with argument k*x, where x is object var.
  10. laplace(1,x,p);
  11. 1
  12. ---
  13. p
  14. laplace(c,x,p);
  15. c
  16. ---
  17. p
  18. laplace(sin(k*x),x,p);
  19. k
  20. ---------
  21. 2 2
  22. p + k
  23. laplace(sin(x/a),x,p);
  24. a
  25. -----------
  26. 2 2
  27. p *a + 1
  28. laplace(sin(17*x),x,p);
  29. 17
  30. ----------
  31. 2
  32. p + 289
  33. laplace(sinh x,x,p);
  34. 1
  35. --------
  36. 2
  37. p - 1
  38. laplace(cosh(k*x),x,p);
  39. - p
  40. ------------
  41. 2 2
  42. - p + k
  43. laplace(x,x,p);
  44. 1
  45. ----
  46. 2
  47. p
  48. laplace(x**3,x,p);
  49. 6
  50. ----
  51. 4
  52. p
  53. off mcd;
  54. laplace(e**(c*x) + a**x, x, s);
  55. -1 -1
  56. - ((log(a) - s) + (c - s) )
  57. laplace(e**x - e**(a*x) + x**2, x, p);
  58. -3 -1 -1
  59. 2*p + ( - p + a) + (p - 1)
  60. laplace(one(k*t) + sin(a*t) - cos(b*t) - e**t, t, p);
  61. 2 2 -1 -1 2 2 -1 -1
  62. - p*(p + b ) + p + (p + a ) *a - (p - 1)
  63. laplace(sqrt(x),x,p);
  64. - 3/2
  65. 1/2*sqrt(pi)*p
  66. laplace(x**(1/2),x,p);
  67. - 3/2
  68. 1/2*sqrt(pi)*p
  69. on mcd;
  70. laplace(x**(-1/2),x,p);
  71. sqrt(pi)
  72. ----------
  73. sqrt(p)
  74. laplace(x**(5/2),x,p);
  75. 15*sqrt(pi)
  76. --------------
  77. 3
  78. 8*sqrt(p)*p
  79. laplace(-1/4*x**2*c*sqrt(x), x, p);
  80. - 15*sqrt(pi)*c
  81. ------------------
  82. 3
  83. 32*sqrt(p)*p
  84. % Elementary functions with argument k*x - tau,
  85. % where k>0, tau>=0, x is object var.
  86. laplace(cos(x-a),x,p);
  87. p
  88. ---------------
  89. p*a 2
  90. e *(p + 1)
  91. laplace(one(k*x-tau),x,p);
  92. 1
  93. --------------
  94. (p*tau)/k
  95. e *p
  96. laplace(sinh(k*x-tau),x,p);
  97. - k
  98. -------------------------
  99. (p*tau)/k 2 2
  100. e *( - p + k )
  101. laplace(sinh(k*x),x,p);
  102. - k
  103. ------------
  104. 2 2
  105. - p + k
  106. laplace((a*x-b)**c,x,p);
  107. c
  108. a *gamma(c + 1)
  109. -----------------
  110. c (p*b)/a
  111. p *e *p
  112. % But ...
  113. off mcd;
  114. laplace((a*x-b)**2,x,p);
  115. -3 2 2 2
  116. p *(p *b - 2*p*a*b + 2*a )
  117. on mcd;
  118. laplace(sin(2*x-3),x,p);
  119. 2
  120. -------------------
  121. (3*p)/2 2
  122. e *(p + 4)
  123. on lmon;
  124. laplace(sin(2*x-3),x,p);
  125. 2
  126. -------------------
  127. (3*p)/2 2
  128. e *(p + 4)
  129. off lmon;
  130. off mcd;
  131. laplace(cosh(t-a) - sin(3*t-5), t, p);
  132. - p*a 2 -1 - 5/3*p 2 -1
  133. e *p*(p - 1) - 3*e *(p + 9)
  134. on mcd;
  135. % More complicated examples - multiplication of functions.
  136. % We use here on lmon - a new switch that forces all
  137. % trigonometrical functions which depend on object var
  138. % to be represented as exponents.
  139. laplace(x*e**(a*x)*cos(k*x), x, p);
  140. 2 2 2
  141. p - 2*p*a + a - k
  142. -------------------------------------------------------------------------
  143. 4 3 2 2 2 2 3 2 4 2 2 4
  144. p - 4*p *a + 6*p *a + 2*p *k - 4*p*a - 4*p*a*k + a + 2*a *k + k
  145. laplace(x**(1/2)*e**(a*x), x, p);
  146. - sqrt(pi)
  147. --------------------------
  148. 2*sqrt(p - a)*( - p + a)
  149. laplace(-1/4*e**(a*x)*(x-k)**(-1/2), x, p);
  150. a*k
  151. - sqrt(pi)*e
  152. --------------------
  153. p*k
  154. 4*e *sqrt(p - a)
  155. laplace(x**(5/2)*e**(a*x), x, p);
  156. - 15*sqrt(pi)
  157. ----------------------------------------------
  158. 3 2 2 3
  159. 8*sqrt(p - a)*( - p + 3*p *a - 3*p*a + a )
  160. laplace((a*x-b)**c*e**(k*x)*const/2, x, p);
  161. (b*k)/a c
  162. - e *a *gamma(c + 1)*const
  163. -----------------------------------
  164. (p*b)/a c
  165. 2*e *(p - k) *( - p + k)
  166. off mcd;
  167. laplace(x*e**(a*x)*sin(7*x)/c*3, x, p);
  168. 2 2 -2 -1
  169. 42*(p - 2*p*a + a + 49) *c *(p - a)
  170. on mcd;
  171. laplace(x*e**(a*x)*sin(k*x-tau), x, p);
  172. (a*tau)/k 2 2 2 (p*tau)/k
  173. (e *(p *tau - 2*p*a*tau + 2*p*k + a *tau - 2*a*k + k *tau))/(e
  174. 4 3 2 2 2 2 3 2 4 2 2 4
  175. *(p - 4*p *a + 6*p *a + 2*p *k - 4*p*a - 4*p*a*k + a + 2*a *k + k ))
  176. % The next is unknown if lmon is off.
  177. laplace(sin(k*x)*cosh(k*x), x, p);
  178. *** Laplace for cosh(x*k)*sin(x*k) not known - try ON LMON
  179. laplace(cosh(k*x)*sin(k*x),x,p)
  180. laplace(x**(1/2)*sin(k*x), x, p);
  181. *** Laplace for sqrt(x)*sin(x*k) not known - try ON LMON
  182. laplace(sqrt(x)*sin(k*x),x,p)
  183. on lmon;
  184. % But now is OK.
  185. laplace(x**(1/2)*sin(a*x)*cos(a*b), x, p);
  186. (sqrt(pi)*cos(a*b)
  187. *(sqrt(p - a*i)*p*i - sqrt(p + a*i)*p*i + sqrt(p - a*i)*a + sqrt(p + a*i)*a))/(
  188. 2 2
  189. 4*sqrt(p + a*i)*sqrt(p - a*i)*(p + a ))
  190. laplace(sin(x)*cosh(x), x, p);
  191. 2
  192. p + 2
  193. --------
  194. 4
  195. p + 4
  196. laplace(sin(k*x)*cosh(k*x), x, p);
  197. 2 2
  198. k*(p + 2*k )
  199. ---------------
  200. 4 4
  201. p + 4*k
  202. % Off exp leads to very messy output in this case.
  203. % off exp; laplace(sin(k*x-t)*cosh(k*x-t), x, p); on exp;
  204. laplace(sin(k*x-t)*cosh(k*x-t), x, p);
  205. 2 2
  206. k*(p + 2*k )
  207. ----------------------
  208. (p*t)/k 4 4
  209. e *(p + 4*k )
  210. laplace(cos(x)**2,x,p);
  211. 2
  212. p + 2
  213. ------------
  214. 2
  215. p*(p + 4)
  216. laplace(c*cos(k*x)**2,x,p);
  217. 2 2
  218. c*(p + 2*k )
  219. ---------------
  220. 2 2
  221. p*(p + 4*k )
  222. laplace(c*cos(2/3*x)**2, x, p);
  223. 2
  224. c*(9*p + 8)
  225. ---------------
  226. 2
  227. p*(9*p + 16)
  228. laplace(5*sinh(x)*e**(a*x)*x**3, x, p);
  229. 3 2 2 3 8 7 6 2 6
  230. (120*(p - 3*p *a + 3*p*a + p - a - a))/(p - 8*p *a + 28*p *a - 4*p
  231. 5 3 5 4 4 4 2 4 3 5 3 3
  232. - 56*p *a + 24*p *a + 70*p *a - 60*p *a + 6*p - 56*p *a + 80*p *a
  233. 3 2 6 2 4 2 2 2 7 5
  234. - 24*p *a + 28*p *a - 60*p *a + 36*p *a - 4*p - 8*p*a + 24*p*a
  235. 3 8 6 4 2
  236. - 24*p*a + 8*p*a + a - 4*a + 6*a - 4*a + 1)
  237. off exp;
  238. laplace(sin(2*x-3)*cosh(7*x-5), x, p);
  239. 2 11 2 11 11
  240. p *e + p + 14*p*e - 14*p + 53*e + 53
  241. -------------------------------------------------------------------------
  242. (3*p + 1)/2 5
  243. e *(p + 7 + 2*i)*(p + 7 - 2*i)*(p - 7 + 2*i)*(p - 7 - 2*i)*e
  244. on exp;
  245. laplace(sin(a*x-b)*cosh(c*x-d), x, p);
  246. *** Laplace for - 1/4*one((x*a - b)/a)*one((x*c - d)/c)*i**(-1) not known
  247. *** Laplace for 1/4*one((x*a - b)/a)*one((x*c - d)/c)*i**(-1) not known
  248. a*i*x a*x - b c*x - d 2*c*x 2*d
  249. - e *one(---------)*one(---------)*i*(e + e )
  250. a c
  251. laplace(-----------------------------------------------------------,x,p)
  252. b*i + c*x + d
  253. 4*e
  254. b*i a*x - b c*x - d 2*c*x 2*d
  255. e *one(---------)*one(---------)*i*(e + e )
  256. a c
  257. + laplace(------------------------------------------------------,x,p)
  258. a*i*x + c*x + d
  259. 4*e
  260. % To solve this problem we must tell the program which one-function
  261. % is rightmost shifted. However, in REDUCE 3.4, this rule is still
  262. % not sufficient.
  263. for all x let one(x-b/a)*one(x-d/c) = one(x-b/a);
  264. laplace(sin(a*x-b)*cosh(c*x-d), x, p);
  265. (2*b*c)/a 2 2*d 2 (2*b*c)/a 2*d (2*b*c)/a 2
  266. (a*(e *p + e *p + 2*e *p*c - 2*e *p*c + e *a
  267. (2*b*c)/a 2 2*d 2 2*d 2 (p*b + a*d + b*c)/a
  268. + e *c + e *a + e *c ))/(2*e
  269. 4 2 2 2 2 4 2 2 4
  270. *(p + 2*p *a - 2*p *c + a + 2*a *c + c ))
  271. for all x clear one(x-b/a)*one(x-d/c) ;
  272. off lmon;
  273. % Floating point arithmetic.
  274. % laplace(3.5/c*sin(2.3*x-4.11)*e**(1.5*x), x, p);
  275. on rounded;
  276. laplace(3.5/c*sin(2.3*x-4.11)*e**(1.5*x), x, p);
  277. 117.461059957
  278. ----------------------------------------------------
  279. 1.78695652174*p 2
  280. 2.71828182846 *c*(p - 3.0*p + 7.54)
  281. laplace(x**2.156,x,p);
  282. 2.32056900246
  283. ---------------
  284. 3.156
  285. p
  286. laplace(x**(-0.5),x,p);
  287. 1.77245385091
  288. ---------------
  289. 0.5
  290. p
  291. off rounded;
  292. laplace(x**(-0.5),x,p);
  293. sqrt(pi)
  294. ----------
  295. sqrt(p)
  296. on rounded;
  297. laplace(x*e**(2.35*x)*cos(7.42*x), x, p);
  298. 2
  299. p - 4.7*p - 49.5339
  300. ---------------------------------------------------------
  301. 4 3 2
  302. p - 9.4*p + 143.2478*p - 569.44166*p + 3669.80312521
  303. laplace(x*e**(2.35*x)*cos(7.42*x-74.2), x, p);
  304. 3 2
  305. (160664647206.0*p - 1.11661929808e+12*p + 1.14319162408e+13*p
  306. 10.0*p
  307. - 2.36681205089e+13)/(2.71828182846
  308. 4 3 2
  309. *(p - 9.4*p + 143.2478*p - 569.44166*p + 3669.80312521))
  310. % Higher precision works, but uses more memory.
  311. % precision 20; laplace(x**2.156,x,p);
  312. % laplace(x*e**(2.35*x)*cos(7.42*x-74.2), x, p);
  313. off rounded;
  314. % Integral from 0 to x, where x is object var.
  315. % Syntax is intl(<expr>,<var>,0,<obj.var>).
  316. laplace(c1/c2*intl(2*y**2,y,0,x), x,p);
  317. 4*c1
  318. -------
  319. 4
  320. p *c2
  321. off mcd;
  322. laplace(intl(e**(2*y)*y**2+sqrt(y),y,0,x),x,p);
  323. -1 -3 - 3/2
  324. p *(2*(p - 2) + 1/2*sqrt(pi)*p )
  325. on mcd;
  326. laplace(-2/3*intl(1/2*y*e**(a*y)*sin(k*y),y,0,x), x, p);
  327. 2*k*( - p + a)
  328. -------------------------------------------------------------------------------
  329. 4 3 2 2 2 2 3 2 4 2 2 4
  330. 3*p*(p - 4*p *a + 6*p *a + 2*p *k - 4*p*a - 4*p*a*k + a + 2*a *k + k )
  331. % Use of delta function and derivatives.
  332. laplace(-1/2*delta(x), x, p);
  333. - 1
  334. ------
  335. 2
  336. laplace(delta(x-tau), x, p);
  337. 1
  338. --------
  339. p*tau
  340. e
  341. laplace(c*cos(k*x)*delta(x),x,p);
  342. c
  343. laplace(e**(a*x)*delta(x), x, p);
  344. 1
  345. laplace(c*x**2*delta(x), x, p);
  346. 0
  347. laplace(-1/4*x**2*delta(x-pi), x, p);
  348. 2
  349. - pi
  350. ---------
  351. p*pi
  352. 4*e
  353. laplace(cos(2*x-3)*delta(x-pi),x,p);
  354. cos(3)
  355. --------
  356. p*pi
  357. e
  358. laplace(e**(-b*x)*delta(x-tau), x, p);
  359. 1
  360. --------------
  361. tau*(p + b)
  362. e
  363. on lmon;
  364. laplace(cos(2*x)*delta(x),x,p);
  365. 1
  366. laplace(c*x**2*delta(x), x, p);
  367. 0
  368. laplace(c*x**2*delta(x-pi), x, p);
  369. 2
  370. c*pi
  371. -------
  372. p*pi
  373. e
  374. laplace(cos(a*x-b)*delta(x-pi),x,p);
  375. cos(a*pi - b)
  376. ---------------
  377. p*pi
  378. e
  379. laplace(e**(-b*x)*delta(x-tau), x, p);
  380. 1
  381. --------------
  382. tau*(p + b)
  383. e
  384. off lmon;
  385. laplace(2/3*df(delta x,x),x,p);
  386. 2*p
  387. -----
  388. 3
  389. off exp;
  390. laplace(e**(a*x)*df(delta x,x,5), x, p);
  391. 5
  392. - ( - p + a)
  393. on exp;
  394. laplace(df(delta(x-a),x), x, p);
  395. p
  396. ------
  397. p*a
  398. e
  399. laplace(e**(k*x)*df(delta(x),x), x, p);
  400. p - k
  401. laplace(e**(k*x)*c*df(delta(x-tau),x,2), x, p);
  402. k*tau 2 2
  403. e *c*(p - 2*p*k + k )
  404. ----------------------------
  405. p*tau
  406. e
  407. on lmon;
  408. laplace(e**(k*x)*sin(a*x)*df(delta(x-t),x,2),x,p);
  409. k*t 2*a*i*t 2 2 2*a*i*t 2*a*i*t
  410. (e *( - e *p *i + p *i - 2*e *p*a + 2*e *p*i*k - 2*p*a
  411. 2*a*i*t 2 2*a*i*t 2*a*i*t 2 2
  412. - 2*p*i*k + e *a *i + 2*e *a*k - e *i*k - a *i
  413. 2 t*(p + a*i)
  414. + 2*a*k + i*k ))/(2*e )
  415. off lmon;
  416. % But if tau is positive, Laplace transform is not defined.
  417. laplace(e**(a*x)*delta(x+tau), x, p);
  418. *** Laplace for delta(x + tau) not known - try ON LMON
  419. a*x
  420. laplace(e *delta(tau + x),x,p)
  421. laplace(2*c*df(delta(x+tau),x), x, p);
  422. *** Laplace for df(delta(x + tau),x) not known - try ON LMON
  423. laplace(2*df(delta(tau + x),x)*c,x,p)
  424. laplace(e**(k*x)*df(delta(x+tau),x,3), x, p);
  425. *** Laplace for df(delta(x + tau),x,3) not known - try ON LMON
  426. k*x
  427. laplace(e *df(delta(tau + x),x,3),x,p)
  428. % Adding new let rules for Laplace operator. Note the syntax.
  429. for all x let laplace(log(x),x) = -log(gam*il!&)/il!&;
  430. laplace(-log(x)*a/4, x, p);
  431. log(p*gam)*a
  432. --------------
  433. 4*p
  434. laplace(-log(x),x,p);
  435. log(p*gam)
  436. ------------
  437. p
  438. laplace(a*log(x)*e**(k*x), x, p);
  439. log(gam*(p - k))*a
  440. --------------------
  441. - p + k
  442. for all x clear laplace(log(x),x);
  443. operator f;
  444. for all x let
  445. laplace(df(f(x),x),x) = il!&*laplace(f(x),x) - sub(x=0,f(x));
  446. for all x,n such that numberp n and fixp n let
  447. laplace(df(f(x),x,n),x) = il!&**n*laplace(f(x),x) -
  448. for i:=n-1 step -1 until 0 sum
  449. sub(x=0, df(f(x),x,n-1-i)) * il!&**i ;
  450. for all x let laplace(f(x),x) = f(il!&);
  451. laplace(1/2*a*df(-2/3*f(x)*c,x), x,p);
  452. a*c*( - p*f(p) + f(0))
  453. ------------------------
  454. 3
  455. laplace(1/2*a*df(-2/3*f(x)*c,x,4), x,p);
  456. 4 3 2
  457. (a*c*( - p *f(p) + p *f(0) + p *sub(x=0,df(f(x),x)) + p*sub(x=0,df(f(x),x,2))
  458. + sub(x=0,df(f(x),x,3))))/3
  459. laplace(1/2*a*e**(k*x)*df(-2/3*f(x)*c,x,2), x,p);
  460. 2 2
  461. (a*c*( - p *f(p - k) + 2*p*f(p - k)*k + p*f(0) - f(p - k)*k - f(0)*k
  462. + sub(x=0,df(f(x),x))))/3
  463. clear f;
  464. % Or if the boundary conditions are known and assume that
  465. % f(i,0)=sub(x=0,df(f(x),x,i)) the above may be overwritten as:
  466. operator f;
  467. for all x let
  468. laplace(df(f(x),x),x) = il!&*laplace(f(x),x) - f(0,0);
  469. for all x,n such that numberp n and fixp n let
  470. laplace(df(f(x),x,n),x) = il!&**n*laplace(f(x),x) -
  471. for i:=n-1 step -1 until 0 sum il!&**i * f(n-1-i,0);
  472. for all x let laplace(f(x),x) = f(il!&);
  473. let f(0,0)=0, f(1,0)=1, f(2,0)=2, f(3,0)=3;
  474. laplace(1/2*a*df(-2/3*f(x)*c,x), x,p);
  475. - p*f(p)*a*c
  476. ---------------
  477. 3
  478. laplace(1/2*a*df(-2/3*f(x)*c,x,4), x,p);
  479. 4 2
  480. a*c*( - p *f(p) + p + 2*p + 3)
  481. ---------------------------------
  482. 3
  483. clear f(0,0), f(1,0), f(2,0), f(3,0);
  484. clear f;
  485. % Very complicated examples.
  486. on lmon;
  487. laplace(sin(a*x-b)**2, x, p);
  488. 2
  489. 2*a
  490. ------------------------
  491. (p*b)/a 2 2
  492. e *p*(p + 4*a )
  493. off mcd;
  494. laplace(x**3*(sin x)**4*e**(5*k*x)*c/2, x,p);
  495. -4 -4 -4
  496. c*(3/16*( - p + 4*i + 5*k) + 3/16*(p + 4*i - 5*k) - 3/4*( - p + 2*i + 5*k)
  497. -4 -4
  498. - 3/4*(p + 2*i - 5*k) + 9/8*( - p + 5*k) )
  499. a:=(sin x)**4*e**(5*k*x)*c/2;
  500. 5*k*x 4
  501. a := 1/2*e *sin(x) *c
  502. laplace(x**3*a,x,p);
  503. -4 -4 -4
  504. c*(3/16*( - p + 4*i + 5*k) + 3/16*(p + 4*i - 5*k) - 3/4*( - p + 2*i + 5*k)
  505. -4 -4
  506. - 3/4*(p + 2*i - 5*k) + 9/8*( - p + 5*k) )
  507. clear a;
  508. on mcd;
  509. % And so on, but is very time consuming.
  510. % laplace(e**(k*x)*x**2*sin(a*x-b)**2, x, p);
  511. % for all x let one(a*x-b)*one(c*x-d) = one(c*x-d);
  512. % laplace(x*e**(-2*x)*cos(a*x-b)*sinh(c*x-d), x, p);
  513. % for all x clear one(a*x-b)*one(c*x-d) ;
  514. % laplace(x*e**(c*x)*sin(k*x)**3*cosh(x)**2*cos(a*x), x, p);
  515. off lmon;
  516. % Error messages.
  517. laplace(sin(-x),x,p);
  518. ***** Laplace induces one( - x) which is not allowed
  519. laplace( - sin(x),x,p)
  520. on lmon;
  521. laplace(sin(-a*x), x, p);
  522. ***** Laplace induces one( - x*a) which is not allowed
  523. laplace( - sin(a*x),x,p)
  524. off lmon;
  525. laplace(e**(k*x**2), x, p);
  526. *** Laplace for e**(x**2*k) not known - try ON LMON
  527. 2
  528. k*x
  529. laplace(e ,x,p)
  530. laplace(sin(-a*x+b)*cos(c*x+d), x, p);
  531. *** Laplace for - cos(x*c + d)*sin(x*a - b) not known - try ON LMON
  532. laplace( - cos(c*x + d)*sin(a*x - b),x,p)
  533. laplace(x**(-5/2),x,p);
  534. *** Laplace for x**( - 5/2) not known - try ON LMON
  535. 1
  536. laplace(------------,x,p)
  537. 2
  538. sqrt(x)*x
  539. % With int arg, can't be shifted.
  540. laplace(intl(y*e**(a*y)*sin(k*y-tau),y,0,x), x, p);
  541. *** Laplace for sin(x*k - tau) not allowed
  542. a*x
  543. laplace(e *sin(k*x - tau)*x,x,p)
  544. ------------------------------------
  545. p
  546. laplace(cosh(x**2), x, p);
  547. *** Laplace for cosh(x**2) not known - try ON LMON
  548. 2
  549. laplace(cosh(x ),x,p)
  550. laplace(3*x/(x**2-5*x+6),x,p);
  551. *** Laplace for (x**2 - 5*x + 6)**(-1) not known - try ON LMON
  552. 3*x
  553. laplace(--------------,x,p)
  554. 2
  555. x - 5*x + 6
  556. laplace(1/sin(x),x,p);
  557. *** Laplace for sin(x)**(-1) not known - try ON LMON
  558. 1
  559. laplace(--------,x,p)
  560. sin(x)
  561. % But ...
  562. laplace(x/sin(-3*a**2),x,p);
  563. - 1
  564. --------------
  565. 2 2
  566. p *sin(3*a )
  567. % Severe errors.
  568. % laplace(sin x,x,cos y);
  569. % laplace(sin x,x,y+1);
  570. % laplace(sin(x+1),x+1,p);
  571. Comment Examples of Inverse Laplace transformations;
  572. symbolic(ordl!* := nil);
  573. % To nullify previous order declarations.
  574. order t;
  575. % Elementary ratio of polynomials.
  576. invlap(1/p, p, t);
  577. 1
  578. invlap(1/p**3, p, t);
  579. 2
  580. t
  581. ----
  582. 2
  583. invlap(1/(p-a), p, t);
  584. t*a
  585. e
  586. invlap(1/(2*p-a),p,t);
  587. (t*a)/2
  588. e
  589. ----------
  590. 2
  591. invlap(1/(p/2-a),p,t);
  592. 2*t*a
  593. 2*e
  594. invlap(e**(-k*p)/(p-a), p, t);
  595. t*a
  596. e
  597. ------
  598. a*k
  599. e
  600. invlap(b**(-k*p)/(p-a), p, t);
  601. t*a
  602. e
  603. ------
  604. a*k
  605. b
  606. invlap(1/(p-a)**3, p, t);
  607. t*a 2
  608. e *t
  609. ---------
  610. 2
  611. invlap(1/(c*p-a)**3, p, t);
  612. (t*a)/c 2
  613. e *t
  614. -------------
  615. 3
  616. 2*c
  617. invlap(1/(p/c-a)**3, p, t);
  618. t*a*c 2 3
  619. e *t *c
  620. --------------
  621. 2
  622. invlap((c*p-a)**(-1)/(c*p-a)**2, p, t);
  623. (t*a)/c 2
  624. e *t
  625. -------------
  626. 3
  627. 2*c
  628. invlap(c/((p/c-a)**2*(p-a*c)), p, t);
  629. t*a*c 2 3
  630. e *t *c
  631. --------------
  632. 2
  633. invlap(1/(p*(p-a)), p, t);
  634. t*a
  635. e - 1
  636. ----------
  637. a
  638. invlap(c/((p-a)*(p-b)), p, t);
  639. t*a t*b
  640. c*(e - e )
  641. -----------------
  642. a - b
  643. invlap(p/((p-a)*(p-b)), p, t);
  644. t*a t*b
  645. e *a - e *b
  646. -----------------
  647. a - b
  648. off mcd;
  649. invlap((p+d)/(p*(p-a)), p, t);
  650. t*a -1 t*a -1
  651. e *a *d + e - a *d
  652. invlap((p+d)/((p-a)*(p-b)), p, t);
  653. -1 t*a t*a t*b t*b
  654. (a - b) *(e *a + e *d - e *b - e *d)
  655. invlap(1/(e**(k*p)*p*(p+1)), p, t);
  656. - t + k
  657. - e + one(t - k)
  658. on mcd;
  659. off exp;
  660. invlap(c/(p*(p+a)**2), p, t);
  661. t*a
  662. - (a*t + 1 - e )*c
  663. -----------------------
  664. t*a 2
  665. e *a
  666. on exp;
  667. invlap(1, p, t);
  668. delta(t)
  669. invlap(c1*p/c2, p, t);
  670. df(delta(t),t)*c1
  671. -------------------
  672. c2
  673. invlap(p/(p-a), p, t);
  674. t*a
  675. delta(t) + e *a
  676. invlap(c*p**2, p, t);
  677. df(delta(t),t,2)*c
  678. invlap(p**2*e**(-a*p)*c, p, t);
  679. sub(t=t - a,df(delta(t),t,2))*c
  680. off mcd;
  681. invlap(e**(-a*p)*(1/p**2-p/(p-1))+c/p, p, t);
  682. t - a
  683. t - delta(t - a) - e - a + c
  684. on mcd;
  685. invlap(a*p**2-2*p+1, p, x);
  686. delta(x) + df(delta(x),x,2)*a - 2*df(delta(x),x)
  687. % P to non-integer power in denominator - i.e. gamma-function case.
  688. invlap(1/sqrt(p), p, t);
  689. 1
  690. ------------------
  691. sqrt(t)*sqrt(pi)
  692. invlap(1/sqrt(p-a), p, t);
  693. t*a
  694. e
  695. ------------------
  696. sqrt(t)*sqrt(pi)
  697. invlap(c/(p*sqrt(p)), p, t);
  698. 2*sqrt(t)*c
  699. -------------
  700. sqrt(pi)
  701. invlap(c*sqrt(p)/p**2, p, t);
  702. 2*sqrt(t)*c
  703. -------------
  704. sqrt(pi)
  705. invlap((p-a)**(-3/2), p, t);
  706. t*a
  707. 2*sqrt(t)*e
  708. ----------------
  709. sqrt(pi)
  710. invlap(sqrt(p-a)*c/(p-a)**2, p, t);
  711. t*a
  712. 2*sqrt(t)*e *c
  713. ------------------
  714. sqrt(pi)
  715. invlap(1/((p-a)*b*sqrt(p-a)), p, t);
  716. t*a
  717. 2*sqrt(t)*e
  718. ----------------
  719. sqrt(pi)*b
  720. invlap((p/(c1-3)-a)**(-3/2), p, t);
  721. t*a*c1
  722. 2*sqrt(t)*e *sqrt(c1 - 3)*(c1 - 3)
  723. -----------------------------------------
  724. 3*t*a
  725. sqrt(pi)*e
  726. invlap(1/((p/(c1-3)-a)*b*sqrt(p/(c1-3)-a)), p, t);
  727. t*a*c1
  728. 2*sqrt(t)*e *sqrt(c1 - 3)*(c1 - 3)
  729. -----------------------------------------
  730. 3*t*a
  731. sqrt(pi)*e *b
  732. invlap((p*2-a)**(-3/2), p, t);
  733. (t*a)/2
  734. sqrt(t)*e
  735. ------------------
  736. sqrt(pi)*sqrt(2)
  737. invlap(sqrt(2*p-a)*c/(p*2-a)**2, p, t);
  738. (t*a)/2
  739. sqrt(t)*e *sqrt(2)*c
  740. ----------------------------
  741. 2*sqrt(pi)
  742. invlap(c/p**(7/2), p, t);
  743. 2
  744. 8*sqrt(t)*t *c
  745. ----------------
  746. 15*sqrt(pi)
  747. invlap(p**(-7/3), p, t);
  748. 1/3
  749. t *t
  750. ------------
  751. 7
  752. gamma(---)
  753. 3
  754. invlap(gamma(b)/p**b,p,t);
  755. b
  756. t
  757. ----
  758. t
  759. invlap(c*gamma(b)*(p-a)**(-b),p,t);
  760. b t*a
  761. t *e *c
  762. -----------
  763. t
  764. invlap(e**(-k*p)/sqrt(p-a), p, t);
  765. t*a
  766. e
  767. ---------------------------
  768. a*k
  769. sqrt(pi)*e *sqrt(t - k)
  770. % Images that give elementary object functions.
  771. % Use of new switches lmon, lhyp.
  772. invlap(k/(p**2+k**2), p, t);
  773. 2*t*i*k
  774. i*( - e + 1)
  775. ---------------------
  776. t*i*k
  777. 2*e
  778. % This is made more readable by :
  779. on ltrig;
  780. invlap(k/(p**2+k**2), p, t);
  781. sin(t*k)
  782. invlap(p/(p**2+1), p, t);
  783. cos(t)
  784. invlap((p**2-a**2)/(p**2+a**2)**2, p, t);
  785. t*cos(t*a)
  786. invlap(p/(p**2+a**2)**2, p, t);
  787. t*sin(t*a)
  788. ------------
  789. 2*a
  790. invlap((p-a)/((p-a)**2+b**2), p, t);
  791. t*a
  792. e *cos(t*b)
  793. off ltrig;
  794. on lhyp;
  795. invlap(s/(s**2-k**2), s, t);
  796. cosh(t*k)
  797. invlap(e**(-tau/k*p)*p/(p**2-k**2), p, t);
  798. cosh(t*k - tau)
  799. off lhyp;
  800. % But it is not always possible to convert expt. functions, e.g.:
  801. on lhyp;
  802. invlap(k/((p-a)**2-k**2), p, t);
  803. sinh(t*k)*(cosh(t*a) + sinh(t*a))
  804. off lhyp;
  805. on ltrig;
  806. invlap(e**(-tau/k*p)*k/(p**2+k**2), p, t);
  807. 2*t*i*k 2*i*tau
  808. i*( - e + e )
  809. ----------------------------
  810. i*(t*k + tau)
  811. 2*e
  812. off ltrig;
  813. % In such situations use the default switches:
  814. invlap(k/((p-a)**2-k**2), p, t);
  815. t*a 2*t*k
  816. e *(e - 1)
  817. -------------------
  818. t*k
  819. 2*e
  820. % i.e. e**(a*t)*cosh(k*t).
  821. invlap(e**(-tau/k*p)*k/(p**2+k**2), p, t);
  822. 2*t*i*k 2*i*tau
  823. i*( - e + e )
  824. ----------------------------
  825. i*(t*k + tau)
  826. 2*e
  827. % i.e. sin(k*t-tau).
  828. % More complicated examples.
  829. off exp,mcd;
  830. invlap((p+d)/(p**2*(p-a)), p, t);
  831. t*a -2
  832. - ((d*t + 1)*a + d - e *(a + d))*a
  833. invlap(e**(-tau/k*p)*c/(p*(p-a)**2), p, t);
  834. -1
  835. - (k *tau - t)*a -1 -1 -2
  836. - (e *((k *tau - t)*a + 1) - one(t - k *tau))*a *c
  837. invlap(1/((p-a)*(p-b)*(p-c)), p, t);
  838. t*b 2 -1 t*c 2 -1
  839. - (e *(a*b - a*c - b + b*c) - e *(a*b - a*c - b*c + c )
  840. t*a 2 -1
  841. - e *(a - a*b - a*c + b*c) )
  842. invlap((p**2+g*p+d)/(p*(p-a)**2), p, t);
  843. t*a -2 -2 t*a -1
  844. - (e *(a *d - 1) - a *d - e *(a + a *d + g)*t)
  845. on exp,mcd;
  846. invlap(k*c**(-b*p)/((p-a)**2+k**2), p, t);
  847. t*a 2*b*i*k 2*t*i*k
  848. e *i*(c - e )
  849. ------------------------------
  850. t*i*k a*b + b*i*k
  851. 2*e *c
  852. on ltrig;
  853. invlap(c/(p**2*(p**2+a**2)), p, t);
  854. c*(t*a - sin(t*a))
  855. --------------------
  856. 3
  857. a
  858. invlap(1/(p**2-p+1), p, t);
  859. t/2 sqrt(3)*t
  860. 2*e *sin(-----------)
  861. 2
  862. -------------------------
  863. sqrt(3)
  864. invlap(1/(p**2-p+1)**2, p, t);
  865. t/2 sqrt(3)*t sqrt(3)*t
  866. 2*e *( - 3*t*cos(-----------) + 2*sqrt(3)*sin(-----------))
  867. 2 2
  868. ---------------------------------------------------------------
  869. 9
  870. invlap(2*a**2/(p*(p**2+4*a**2)), p, t);
  871. - cos(2*t*a) + 1
  872. -------------------
  873. 2
  874. % This is (sin(a*t))**2 and you can get this by using the let rules :
  875. for all x let sin(2*x)=2*sin x*cos x, cos(2*x)=(cos x)**2-(sin x)**2,
  876. (cos x)**2 =1-(sin x)**2;
  877. invlap(2*a**2/(p*(p**2+4*a**2)), p, t);
  878. 2
  879. sin(t*a)
  880. for all x clear sin(2*x),cos(2*x),cos(x)**2;
  881. off ltrig;
  882. on lhyp;
  883. invlap((p**2-2*a**2)/(p*(p**2-4*a**2)),p,t);
  884. cosh(2*t*a) + 1
  885. -----------------
  886. 2
  887. off lhyp;
  888. % Analogously, the above is (cosh(a*t))**2.
  889. % Floating arithmetic.
  890. invlap(2.55/((0.5*p-2.0)*(p-3.3333)), p, t);
  891. (33333*t)/10000 4*t
  892. 51000*( - e + e )
  893. ------------------------------------
  894. 6667
  895. on rounded;
  896. invlap(2.55/((0.5*p-2.0)*(p-3.3333)), p, t);
  897. 4.0*t 3.3333*t
  898. 7.64961751912*2.71828182846 - 7.64961751912*2.71828182846
  899. invlap(1.5/sqrt(p-0.5), p, t);
  900. 0.5*t
  901. 0.846284375322*2.71828182846
  902. -----------------------------------
  903. 0.5
  904. t
  905. invlap(2.75*p**2-0.5*p+e**(-0.9*p)/p, p, t);
  906. 2.75*df(delta(t),t,2) - 0.5*df(delta(t),t) + one(t - 0.9)
  907. invlap(1/(2.0*p-3.0)**3, p, t);
  908. 1.5*t 2
  909. 0.0625*2.71828182846 *t
  910. invlap(1/(2.0*p-3.0)**(3/2), p, t);
  911. 0.5 1.5*t
  912. 0.398942280401*t *2.71828182846
  913. invlap(1/(p**2-5.0*p+6), p, t);
  914. 3.0*t 2.0*t
  915. 2.71828182846 - 2.71828182846
  916. off rounded;
  917. % Adding new let rules for the invlap operator. note the syntax:
  918. for all x let invlap(log(gam*x)/x,x) = -log(lp!&);
  919. invlap(-1/2*log(gam*p)/p, p, t);
  920. log(t)
  921. --------
  922. 2
  923. invlap(-e**(-a*p)*log(gam*p)/(c*p), p, t);
  924. log(t - a)
  925. ------------
  926. c
  927. for all x clear invlap(1/x*log(gam*x),x);
  928. % Very complicated examples and use of factorizer.
  929. off exp,mcd;
  930. invlap(c**(-k*p)*(p**2+g*p+d)/(p**2*(p-a)**3), p, t);
  931. - (log(c)*k - t)*a -4
  932. (e - 1)*(a*g + 3*d)*a
  933. - (log(c)*k - t)*a 2 -1 -2
  934. + 1/2*e *( - t + log(c)*k) *(a *g + a *d + 1)
  935. - (log(c)*k - t)*a -3
  936. + (e *(a*g + 2*d) + d)*(log(c)*k - t)*a
  937. on exp,mcd;
  938. invlap(1/(2*p**3-5*p**2+4*p-1), p, t);
  939. t t/2 t
  940. e *t + 2*e - 2*e
  941. on ltrig,lhyp;
  942. invlap(1/(p**4-a**4), p, t);
  943. - sin(t*a) + sinh(t*a)
  944. -------------------------
  945. 3
  946. 2*a
  947. invlap(1/((b-3)*p**4-a**4*(2+b-5)), p, t);
  948. - sin(t*a) + sinh(t*a)
  949. -------------------------
  950. 3
  951. 2*a *(b - 3)
  952. off ltrig,lhyp;
  953. % The next three examples are the same:
  954. invlap(c/(p**3/8-9*p**2/4+27/2*p-27)**2,p,t);
  955. 6*t 5
  956. 8*e *t *c
  957. -------------
  958. 15
  959. invlap(c/(p/2-3)**6,p,t);
  960. 6*t 5
  961. 8*e *t *c
  962. -------------
  963. 15
  964. off exp;
  965. a:=(p/2-3)**6;
  966. 6
  967. (p - 6)
  968. a := ----------
  969. 64
  970. on exp;
  971. invlap(c/a, p, t);
  972. 6*t 5
  973. 8*e *t *c
  974. -------------
  975. 15
  976. clear a;
  977. % The following two examples are the same :
  978. invlap(c/(p**4+2*p**2+1)**2, p, t);
  979. 2*t*i 3 3 2*t*i 2 2 2*t*i 2*t*i
  980. (c*(e *t + t + 6*e *t *i - 6*t *i - 15*e *t - 15*t - 15*e *i
  981. t*i
  982. + 15*i))/(96*e )
  983. invlap(c/((p-i)**4*(p+i)**4),p,t);
  984. 2*t*i 3 3 2*t*i 2 2 2*t*i 2*t*i
  985. (c*(e *t + t + 6*e *t *i - 6*t *i - 15*e *t - 15*t - 15*e *i
  986. t*i
  987. + 15*i))/(96*e )
  988. % The following three examples are the same :
  989. invlap(e**(-k*p)/(2*p-3)**6, p, t);
  990. (3*t)/2 5 4 3 2 2 3 4 5
  991. e *(t - 5*t *k + 10*t *k - 10*t *k + 5*t*k - k )
  992. ------------------------------------------------------------
  993. (3*k)/2
  994. 7680*e
  995. invlap(e**(-k*p)/(4*p**2-12*p+9)**3, p, t);
  996. (3*t)/2 5 4 3 2 2 3 4 5
  997. e *(t - 5*t *k + 10*t *k - 10*t *k + 5*t*k - k )
  998. ------------------------------------------------------------
  999. (3*k)/2
  1000. 7680*e
  1001. invlap(e**(-k*p)/(8*p**3-36*p**2+54*p-27)**2, p, t);
  1002. (3*t)/2 5 4 3 2 2 3 4 5
  1003. e *(t - 5*t *k + 10*t *k - 10*t *k + 5*t*k - k )
  1004. ------------------------------------------------------------
  1005. (3*k)/2
  1006. 7680*e
  1007. % Error messages.
  1008. invlap(e**(a*p)/p, p, t);
  1009. *** Invlap for e**(p*a)/p not known
  1010. a*p
  1011. e
  1012. invlap(------,p,t)
  1013. p
  1014. invlap(c*p*sqrt(p), p, t);
  1015. *** Invlap for sqrt(p)*p not known
  1016. invlap(sqrt(p)*c*p,p,t)
  1017. invlap(sin(p), p, t);
  1018. *** Invlap for sin(p) not known
  1019. invlap(sin(p),p,t)
  1020. invlap(1/(a*p**3+b*p**2+c*p+d),p,t);
  1021. *** Invlap for (p**3*a + p**2*b + p*c + d)**(-1) not known
  1022. 1
  1023. invlap(-----------------------,p,t)
  1024. 3 2
  1025. a*p + b*p + c*p + d
  1026. invlap(1/(p**2-p*sin(p)+a**2),p,t);
  1027. *** Invlap for (p**2 - p*sin(p) + a**2)**(-1) not known
  1028. - 1
  1029. invlap(--------------------,p,t)
  1030. 2 2
  1031. sin(p)*p - a - p
  1032. on rounded;
  1033. invlap(1/(p**3-1), p, t);
  1034. *** Invlap for (p**3 - 1)**(-1) not known
  1035. 1
  1036. invlap(--------,p,t)
  1037. 3
  1038. p - 1
  1039. off rounded;
  1040. % Severe errors:
  1041. %invlap(1/(p**2+1), p+1, sin(t) );
  1042. %invlap(p/(p+1)**2, sin(p), t);
  1043. end;
  1044. 4: 4: 4: 4: 4: 4: 4: 4: 4:
  1045. Time for test: 5640 ms, plus GC time: 330 ms
  1046. 5: 5:
  1047. Quitting
  1048. Mon Jan 4 00:04:37 MET 1999