0
$\begingroup$

I have a series with e.g. Chebyshevs: $\sum_i^N a_i T_i(x)$ where they are decreasing in size with increasing $i$.

So now suppose I multiply two such series: $(\sum_i^N a_i T_i(x))(\sum_i^N b_i T_i(x))$ where each $a_i \sim b_i$ in size.

I want to truncate the product of these by their combined size, e.g. If $a_i b_i < 10^{-6}$ truncate.

Clearly it's a problem to truncate by powers, since only by cancellations inside the Chebyshevs, the basis stays within $[-1,1]$. So I mustn't evaluate the Chebyshevs, i.e. they need to stay 'like a symbol'.

I tried using Hold to stop evaluating and then chopping e.g.: Chop[10^-4 Hold[ChebyshevT[20, x]], 10^-2] (and also: Chop[Hold[10^-4 ChebyshevT[20, x]], 10^-2]). This does not delete the term, as Mathematica treats Hold[...] as an unknown symbol, so it does not want to only look at the coefficient.

(I technically have a set of replacement rules for the coefficients, so using this and manipulation of rules, I could truncate the total rules for the product of coefficients and then applying the rules afterwards. But there must be a more elegant method to this, since not always will there be such a convenient case.)

$\endgroup$
1
  • $\begingroup$ I did look through stackexchange, but mostly they only truncate by powers of a variable, which is not appropriate here. $\endgroup$ Commented Jan 26, 2024 at 11:51

1 Answer 1

1
$\begingroup$

You may use "Chop" to remove small terms. Here is an example:

SeedRandom[1]; n = 3; as = Sort[Table[RandomReal[{-1, 1}], {i, 0, n}]]; bs = Sort[Table[RandomReal[{-1, 1}], {i, 0, n}]]; ts = Table[T[i, x], {i, 0, n}]; ex = as . ts bs . ts // Expand 0.674982 T[0, x]^2 + 0.960172 T[0, x] T[1, x] + 0.335731 T[1, x]^2 - 0.100911 T[0, x] T[2, x] + 0.0116341 T[1, x] T[2, x] - 0.299531 T[2, x]^2 - 0.616985 T[0, x] T[3, x] - 0.394072 T[1, x] T[3, x] - 0.279431 T[2, x] T[3, x] + 0.0536345 T[3, x]^2 Chop[ex, 0.1] 0.674982 T[0, x]^2 + 0.960172 T[0, x] T[1, x] + 0.335731 T[1, x]^2 - 0.100911 T[0, x] T[2, x] - 0.299531 T[2, x]^2 - 0.616985 T[0, x] T[3, x] - 0.394072 T[1, x] T[3, x] - 0.279431 T[2, x] T[3, x] 
$\endgroup$
4
  • $\begingroup$ Correct me if I'm wrong, but this only works if T is a symbol rather than ChebyshevT? I tried yours by replacing T with ChebyshevT and it did not work (since Chebyshev got evaluated.) $\endgroup$ Commented Jan 26, 2024 at 12:42
  • $\begingroup$ In case the Chebyshev polynomials are expanded, then the coefficients of the Chebyshev polynomial are taken into account for chopping. Question is, if this is desirable or not. If yes, expand it, if no, leave it symbolic. $\endgroup$ Commented Jan 26, 2024 at 13:22
  • $\begingroup$ How do I leave it symbolic? Hold does not work as explained in question. (I do not want to expand, as also explained.) $\endgroup$ Commented Jan 26, 2024 at 13:24
  • $\begingroup$ sorry I get it. Use your solution and then replace by Cheby no? $\endgroup$ Commented Jan 26, 2024 at 13:42

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.