Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
Hi,
I found this file Mathcad - expm.xmcd where it calculates:
It seems that the calculation of exponential with exponent a matrix it is more rapidly done in this way than using e^([matrix]) in Mathcad Prime.
I put this in a Mathcad file (see MCP9 attached file), but I am not sure if I did things correctly (like I do not see a influence of that if 0<n) and I do not fully understand the procedure/calculation (I see that there is 2 methods. What are the difference between them? What is better to use?)
Can someone check and explain the procedure/calculation if understand it?
Solved! Go to Solution.
@Cornel wrote:
I also see that it cannot be evaluated symbolically. This method will work only for numeric values, right? Or is it possible to make also to work with symbolic variable?
The function uses an approximation (just 21 summands of the Taylor series expansion). So it would not make much sense to evaluate it symbolically.
Furthermore, because of this 21 summands, the result would be rather large!
The reason for the while-loop and the continuous division of the matrix A by 2 is to make A small enough so that 21 summand of the series expansion provide enough precision (faster convergence).
You could as well do without but you will have to use much more summands to get a decent precision if the values of the matrix elements are larger.
If you feel like doing so you may evaluate expm2 symbolically with symbolic variables 😉
You could also rewrite the original function an can determine the value of n and the divided matrix using logarithms. That way the function could be evaluated symbolically. But it does not make sense to write an approximation for exp() and using ln() to do so.
I also see that it cannot be evaluated symbolically. This method will work only for numeric values, right? Or is it possible to make also to work with symbolic variable?
@Cornel wrote:
I also see that it cannot be evaluated symbolically. This method will work only for numeric values, right? Or is it possible to make also to work with symbolic variable?
The function uses an approximation (just 21 summands of the Taylor series expansion). So it would not make much sense to evaluate it symbolically.
Furthermore, because of this 21 summands, the result would be rather large!
The reason for the while-loop and the continuous division of the matrix A by 2 is to make A small enough so that 21 summand of the series expansion provide enough precision (faster convergence).
You could as well do without but you will have to use much more summands to get a decent precision if the values of the matrix elements are larger.
If you feel like doing so you may evaluate expm2 symbolically with symbolic variables 😉
You could also rewrite the original function an can determine the value of n and the divided matrix using logarithms. That way the function could be evaluated symbolically. But it does not make sense to write an approximation for exp() and using ln() to do so.
So floating point limits are yet another reason for not using expm2() and rather staying with the original expm().
BTW, here is a version which also can be evaluated using a symbolical matrix.
I didn't wait for the calculation to finish, though, as it does not make any sense at all to evaluate a numerical approximation with symbols.
You may use a lower number like 2 or 3 instead of the 20 to see what expression you can expect from a symbolic eval.
Here I used just 1 instead of 20:
I am thinking to use this:
What do you think @Werner_E ?
It works for symbolics:
And also for numerics:
EDIT:...yeah, but it suffers for same problem:
And also your function:
But I see that this is ok:
But this implementation of expm function does not work for symbolics...
You have to decide what you use depending on your needs!!
And its completely unclear to me, what your needs are, why you would need a function like this with results going up to the IEEE limit of 10^307 or why you would like to symbolically evaluate of an appoiximation!!??
So its your choice ...