回答編集履歴

1

型修正

2022/07/09 20:25

投稿

actorbug
actorbug

スコア2224

test CHANGED
@@ -22,7 +22,7 @@
22
22
  def LogCombine(expr):
23
23
  def f(rv):
24
24
  if rv.is_Add:
25
- logs = defaultdict(lambda: 1)
25
+ logs = defaultdict(lambda: S.One)
26
26
  other = []
27
27
  for arg in rv.args:
28
28
  if isinstance(arg, Log):
@@ -30,7 +30,7 @@
30
30
  else:
31
31
  other.append(arg)
32
32
  for (base, antilog) in logs.items():
33
- if antilog.is_rational and antilog.numerator == S.One:
33
+ if antilog.is_rational and antilog.numerator == 1:
34
34
  other.append(-Log(base, antilog.denominator))
35
35
  else:
36
36
  other.append(Log(base, antilog))