Format a single term in the expansion
(self, scalar_format: Callable, off: float, scale: float)
| 434 | return fr'\text{{{pu.format_float(x, parens=parens)}}}' |
| 435 | |
| 436 | def _format_term(self, scalar_format: Callable, off: float, scale: float): |
| 437 | """ Format a single term in the expansion """ |
| 438 | if off == 0 and scale == 1: |
| 439 | term = self.symbol |
| 440 | needs_parens = False |
| 441 | elif scale == 1: |
| 442 | term = f"{scalar_format(off)} + {self.symbol}" |
| 443 | needs_parens = True |
| 444 | elif off == 0: |
| 445 | term = f"{scalar_format(scale)}{self.symbol}" |
| 446 | needs_parens = True |
| 447 | else: |
| 448 | term = ( |
| 449 | f"{scalar_format(off)} + " |
| 450 | f"{scalar_format(scale)}{self.symbol}" |
| 451 | ) |
| 452 | needs_parens = True |
| 453 | return term, needs_parens |
| 454 | |
| 455 | def _repr_latex_(self): |
| 456 | # get the scaled argument string to the basis functions |
no outgoing calls
no test coverage detected