A How to work with expanded functions?

  • A
  • Thread starter Thread starter Vrbic
  • Start date Start date
  • Tags Tags
    Functions Work
Vrbic
Messages
400
Reaction score
18
TL;DR Summary
How to grab a bit complex problem, which is limited upto some order in some variable, i.e., initial function are expanded upto this order?
I solve problem where I use functions which are expanded upto some order. I multiply them, make square root and make derivatives or solve differential equations. What is the right way to deal with such problem?
Shall I expand all functions after every step or work with unexpanded functions and do it at the end? How manage a numerical solution of differential equations? Is there any recipe?

Thank you for all comments and responses.
 
Physics news on Phys.org
Vrbic said:
Summary:: How to grab a bit complex problem, which is limited upto some order in some variable, i.e., initial function are expanded upto this order?

I solve problem where I use functions which are expanded upto some order. I multiply them, make square root and make derivatives or solve differential equations. What is the right way to deal with such problem?
Shall I expand all functions after every step or work with unexpanded functions and do it at the end? How manage a numerical solution of differential equations? Is there any recipe?
Your question is unclear. Are you asking about replacing functions by, say, a polynomial? For example, replacing ##\sin(x)## by a polynomial of degree 3, as in ##\sin(x) \approx x - \frac{x^3}{3!}##?
 
Mark44 said:
Your question is unclear. Are you asking about replacing functions by, say, a polynomial? For example, replacing ##\sin(x)## by a polynomial of degree 3, as in ##\sin(x) \approx x - \frac{x^3}{3!}##?
I solve a problem from physics. The problem is more complex and therefore the description of the problem is only an approximation to the given order. Thus, functions describing the initial state are, say, in the form ## f (x) \approx x - \frac{x ^ 3}{3!} ##. I continue to work with those functions. I am looking for equations of motion etc. and I multiply them, differentiate them, etc. In these operations, higher order terms begin to appear. My question is how to work with these higher order terms during the calculation? Finally, I integrate numerically equations of motion.
 
Vrbic said:
I solve problem where I use functions which are expanded upto some order
So they look like e.g.
$$f(x) = ax^4+bx^3+cx^2+d+{\mathcal O}(x^5) \ \ ?$$ Are you aware what this means, formally ?
 
The problem is not to expand at the end of after every step, if you do it right you will get the same answer, the problem is to know to what order you should expand because maybe you start with a function ##f(x)## that is exact to second order, but your final answer is exact only to first order.

My advice is to write your approximate function as ##f(x)+\mathcal{O}##, and do all the manipulations taking into account the ##\mathcal{O}##, you can expand whenever you want to simplify your life. But anytime you expand, you need to expand only to those terms that are independent on ##\mathcal{O}##.
 
Gaussian97 said:
The problem is not to expand at the end of after every step, if you do it right you will get the same answer, the problem is to know to what order you should expand because maybe you start with a function ##f(x)## that is exact to second order, but your final answer is exact only to first order.

My advice is to write your approximate function as ##f(x)+\mathcal{O}##, and do all the manipulations taking into account the ##\mathcal{O}##, you can expand whenever you want to simplify your life. But anytime you expand, you need to expand only to those terms that are independent on ##\mathcal{O}##.
I uderstand, but let's say, I have a matrix of functions upto second order:

##f_{ab}=f0_{ab}+f1_{ab}+f2_{ab},##
where ##a,b## is postition in matrix and number ##0,1,2## describes order. And I need inverse matrix and to work with it. Matrix is not diagonal, i.e., inversion is not trivial 1/... . In inversion matrix is something like that

##f_{11}=f0_{11}*f0_{44}+...+f1_{11}*f2_{44}+f2_{11}*f2_{44}+...##. Last two terms are higher order then the problem.
And I have to work with this further and finally numerically integrate. Expansion after every step gives different result than I let it be till last step and than expand.
 
BvU said:
So they look like e.g.
$$f(x) = ax^4+bx^3+cx^2+d+{\mathcal O}(x^5) \ \ ?$$ Are you aware what this means, formally ?
Yes, I do. I wrote more to the problem below.
 
Let's put an example on a 2x2 matrix
$$\begin{pmatrix}
f_{11}(x) & f_{12}(x) \\
f_{21}(x) & f_{22}(x) \\
\end{pmatrix}$$
Then, if you want the function ##(f^{-1})_{11}## you need to compute
$$(f^{-1})_{11} = \frac{f_{22}(x)}{f_{11}(x)f_{22}(x)-f_{12}(x)f_{21}(x)}$$
If all the functions ##f_{ij}(x)## are exact to order ##x^2## then ##f^{-1}_{ij}## will be exact to, at least, order ##x^2##

For example, in a 3x3 matrix, you would be
$$(f^{-1})_{11} = \frac{f_{22}f_{33}-f_{23}f_{32}}{f_{11}f_{22}f_{33}-f_{11}f_{23}f_{32}-f_{12}f_{21}f_{33}+f_{12}f_{23}f_{31}+f_{13}f_{21}f_{32}-f_{13}f_{22}f_{31}}$$

In general, you can always work the inverse in your matrix using multiplication, division and sum.

This, of course, becomes more painful when you work with higher matrices, and maybe there's some better way to do it, I'm not a mathematician and I don't usually work with this kind of problems.

For the numerical integration, I don't know, but naively, if you are integrating a second-order approximation in an interval ##[a,b]##, the error may be of the order of ##(b-a)^3##.
 

Similar threads

Back
Top