有什么方法可以在SymPy中获得分步解决方案? [英] Is there any way to get the step-by-step solution in SymPy?

查看:36
本文介绍了有什么方法可以在SymPy中获得分步解决方案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以在SymPy中获得分步解决方案?例如:

Is there any way to get the step-by-step solution in SymPy? For example:

x**2-5 = 4
  step 1 x**2-5+5=4+5
  step 2 : x**2=9
  step 3 :x = 3 or x= -3

推荐答案

(这更多是作为答案的评论)

(this is more a comment as answer)

有一些Google的实施想法

There are some Google's-soc ideas for implementing

GSoC 2014理念:很多时候,人们问他们如何分辨某些功能在做什么.例如,他们想一步一步地了解……对于前者,您能做的最好的就是遵循代码;对于后者,该算法根本无法像您手动完成那样工作,因此实际上是没有办法...

GSoC 2014 Ideas: Many times, people ask how they can tell what some functions are doing. For example, they want to know step by step...... For the former, the best you can do is to follow the code; for the latter, the algorithm doesn't work at all like you would do it by hand, so there's really no way...

GSoC 2015理念:

许多SymPy操作背后的逻辑被分成几个小方法.例如,诸如sin或exp之类的对象具有_eval_derivative方法,这些方法称为SymPy评估诸如sin(exp(x))之类的复杂表达式的导数.通过捕获所有这些小方法的输入和输出,我们可以收集有关SymPy采取的步骤的大量信息.我们可以看到exp._eval_derivative接受了exp(x)并返回了exp(x),sin._eval_derivative接受了sin(exp(x))并返回了cos(exp(x))* exp(x).每种方法的这些输入输出对可能足以说明SymPy如何解决许多领域中的问题.

The logic behind many SymPy operations is separated into several small methods. For example objects like sin or exp have _eval_derivative methods that are called as SymPy evaluates the derivative of a complex expression like sin(exp(x)). By capturing the inputs and outputs of all of these small methods we can collect a great quantity of information about the steps that SymPy takes. We can see that exp._eval_derivative took in exp(x) and returned exp(x) and that sin._eval_derivative took in sin(exp(x)) and returned cos(exp(x))*exp(x). These input-output pairs for each method are probably sufficient to illustrate how SymPy solves problems in many domains.

这种捕获许多内部函数输入的方法类似于传统上用于分析大型代码库的日志记录系统.我们应该调查它们的工作方式以及它们是否对正常运行造成任何问题.

This approach of capturing the inputs of many internal functions is similar to logging systems traditionally used to analyze large codebases. We should investigate how they work and if they cause any problems with normal operation.

一旦获得了这种信息源,我们便可以考虑一些有趣的方式来可视化并与之交互.一个好的解决方案将不会不可避免地将数据流绑定到特定的可视化技术上.

Once this source of information is available we can then think about interesting ways to visualize and to interact with it. A good solution will not irrevocably tie the data stream to a particular visualization technique.

这种方法在理智上很简单,但可能需要学生与许多代码库进行交互._eval_derivative之类的方法在整个SymPy中是普遍存在的,但在不同的模块中通常会有很小的变化.

This approach is straightforward intellectually but may require the student to interact with a lot of the codebase. Approaches like _eval_derivative are ubiquitous throughout SymPy but often have small variations in different modules.

此处为在线解决方案 SymPy Gamma

这篇关于有什么方法可以在SymPy中获得分步解决方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆