0

I do need to numerically calculate the following forms for any $x\in\mathbb{R}^n$, possibly in python:

  1. $x^TM^Kx$, where $M\in\mathbb{R^n}$ is a PSD matrix, where k can get quite large values -possibly up to order of hundreds. I prefer k to be a real number, but it is ok if it can only be an integer, if that makes a considerable accuracy difference.
  2. Similarly I am interested in $x^Te^{-tM}x$ where t is a real value.

For case 1 I can either:

For case 2

  • Again I can use off the shelf scipy.linalg.expm and then exponentiate the singular values of M
  • I can do SVD for M and then go with $x^TU\exp(\Lambda) U^Tx$.
  • Finally since I am only interested in $x^T \exp(M) x$, and not exactly exp(M) it self, I can consider the Taylor expansion of $x^T{\rm expm}(M)x\approx \sum_{i=0}^{l} \frac{1}{i!}x^TM^ix$ for some l that controls the precision, and $x^TM^Kx$ can be calculated based on case 1.

Can anybody guide me about what is the most precise way to calculate either of these expressions, up to hopefully machine precision? Any of these methods, or they're better solutions out there? I would be happy also with references.

P.S. Not knowing if here or math.stackexchange.com being a good place to share this question at, I will be cross-posting it on their with the same title and content.

Cupitor
  • 11,007
  • 19
  • 65
  • 91
  • 1
    Your `$..$` formatting is not very readable. – hpaulj Feb 25 '21 at 17:25
  • @hpaulj, what pain in the butt task it is to write formulas here. This is probably the most time-consuming post I have ever written on stackoverflow – Cupitor Feb 25 '21 at 18:09
  • 1
    As to places to ask on: As a compromise you could consider scicomp.SE, with mathjax *and* code syntax highlighting. – Lutz Lehmann Feb 25 '21 at 18:49
  • Thanks @LutzLehmann, that's what exactly I have been told on other website. – Cupitor Feb 25 '21 at 20:04
  • 1
    It would be better to use raw Latex, a lot of people can read it easily. This post is effectively unreadable when one uses the dark mode. – Bracula Feb 26 '21 at 12:56
  • @Vladimir, ahaha.I exactly changed it because hpaulj complained that the latex format is unreadable! – Cupitor Feb 26 '21 at 19:48

0 Answers0