def print_Chain(self, rule): with self.new_step(), self.new_u_vars() as (u, du): self.append("Sea {}.".format(self.format_math(sympy.Eq(u, rule.inner)))) self.print_rule(replace_u_var(rule.substep, rule.u_var, u)) with self.new_step(): if isinstance(rule.innerstep, FunctionRule): self.append( "Entonces, aplicando la regla de la cadena. Multipicamos por {}:".format( self.format_math( sympy.Derivative(rule.inner, rule.symbol)))) self.append(self.format_math_display(diff(rule))) else: self.append( "Entonces, aplicando la regla de la cadena. Multipicamos por {}:".format( self.format_math( sympy.Derivative(rule.inner, rule.symbol)))) with self.new_level(): self.print_rule(rule.innerstep) self.append("El resultado de la regla de la cadena:") self.append(self.format_math_display(diff(rule)))
def print_Chain(self, rule): with self.new_step(), self.new_u_vars() as (u, du): self.append("Let {}.".format(self.format_math(sympy.Eq(u, rule.inner)))) self.print_rule(replace_u_var(rule.substep, rule.u_var, u)) with self.new_step(): if isinstance(rule.innerstep, FunctionRule): self.append( "Then, apply the chain rule. Multiply by {}:".format( self.format_math( sympy.Derivative(rule.inner, rule.symbol)))) self.append(self.format_math_display(diff(rule))) else: self.append( "Then, apply the chain rule. Multiply by {}:".format( self.format_math( sympy.Derivative(rule.inner, rule.symbol)))) with self.new_level(): self.print_rule(rule.innerstep) self.append("The result of the chain rule is:") self.append(self.format_math_display(diff(rule)))
def print_Chain(self, rule): with self.new_step(), self.new_u_vars() as (u, du): self.append("Let {}.".format( self.format_math(sympy.Eq(u, rule.inner)))) self.print_rule(replace_u_var(rule.substep, rule.u_var, u)) with self.new_step(): if isinstance(rule.innerstep, FunctionRule): self.append( "Then, apply the chain rule. Multiply by {}:".format( self.format_math( sympy.Derivative(rule.inner, rule.symbol)))) self.append(self.format_math_display(diff(rule))) else: self.append( "Then, apply the chain rule. Multiply by {}:".format( self.format_math( sympy.Derivative(rule.inner, rule.symbol)))) with self.new_level(): self.print_rule(rule.innerstep) self.append("The result of the chain rule is:") self.append(self.format_math_display(diff(rule)))
def print_U(self, rule): with self.new_step(), self.new_u_vars() as (u, du): # commutative always puts the symbol at the end when printed dx = sympy.Symbol("d" + rule.symbol.name, commutative=0) self.append("Let {}.".format(self.format_math(sympy.Eq(u, rule.u_func)))) self.append( "Then let {} and substitute {}:".format( self.format_math(sympy.Eq(du, rule.u_func.diff(rule.symbol) * dx)), self.format_math(rule.constant * du), ) ) integrand = rule.substep.context.subs(rule.u_var, u) self.append(self.format_math_display(sympy.Integral(integrand, u))) with self.new_level(): self.print_rule(replace_u_var(rule.substep, rule.u_var, u)) self.append("Now substitute {} back in:".format(self.format_math(u))) self.append(self.format_math_display(_manualintegrate(rule)))
def print_U(self, rule): with self.new_step(), self.new_u_vars() as (u, du): # commutative always puts the symbol at the end when printed dx = sympy.Symbol('d' + rule.symbol.name, commutative=0) self.append("Let {}.".format( self.format_math(sympy.Eq(u, rule.u_func)))) self.append("Then let {} and substitute {}:".format( self.format_math( sympy.Eq(du, rule.u_func.diff(rule.symbol) * dx)), self.format_math(rule.constant * du))) integrand = rule.substep.context.subs(rule.u_var, u) self.append(self.format_math_display(sympy.Integral(integrand, u))) with self.new_level(): self.print_rule(replace_u_var(rule.substep, rule.u_var, u)) self.append("Now substitute {} back in:".format( self.format_math(u))) self.append(self.format_math_display(_manualintegrate(rule)))