How to work with expanded functions?

  • Context: Graduate 
  • Thread starter Thread starter Vrbic
  • Start date Start date
  • Tags Tags
    Functions Work
Click For Summary

Discussion Overview

The discussion revolves around the handling of functions that are expanded up to a certain order in the context of solving differential equations, performing numerical integration, and managing higher order terms. Participants explore whether to expand functions at each step of calculations or to keep them unexpanded until the end, particularly in relation to matrix operations and approximations.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • Some participants inquire whether it is better to expand functions after every calculation step or to work with unexpanded functions until the final result.
  • Others suggest that maintaining the order of approximation is crucial, as expanding too early may lead to different results than intended.
  • A participant describes a scenario involving a matrix of functions and the challenges of inverting such a matrix while considering higher order terms.
  • There is mention of specific examples, such as approximating functions like ##\sin(x)## with polynomials and the implications of these approximations on calculations.
  • Some participants propose writing approximate functions in terms of ##\mathcal{O}## notation to keep track of the order of terms during manipulations.
  • Concerns are raised about the complexity of matrix inversions when dealing with non-diagonal matrices and how this affects numerical integration.

Areas of Agreement / Disagreement

Participants express differing views on the best approach to handling function expansions and the implications of these choices on the accuracy of results. No consensus is reached regarding the optimal method for managing higher order terms or the timing of expansions.

Contextual Notes

Participants highlight the importance of knowing the order of accuracy required for their final results, as starting with a function that is exact to a certain order may not guarantee that the final answer retains that level of accuracy. The discussion also touches on the potential errors introduced during numerical integration based on the order of approximation used.

Vrbic
Messages
400
Reaction score
18
TL;DR
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

  • · Replies 16 ·
Replies
16
Views
3K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K