sympy

Hacker News 简讯 2020-07-08

岁酱吖の 提交于 2020-08-15 03:45:39
最后更新时间: 2020-07-08 15:11 Yoloface-500k: ultra-light real-time face detection model, 500kb - (github.com) Yoloface-500k:超轻实时人脸检测模型,500kb 得分:109 | 评论:27 SymPy - a Python library for symbolic mathematics - (sympy.org) 符号数学的Python库 得分:94 | 评论:20 Ron Graham has died - (ams.org) 罗恩·格雷厄姆去世了 得分:289 | 评论:32 Help Message for Shell Scripts - (samizdat.dev) 外壳脚本的帮助消息 得分:366 | 评论:100 Fig: Visual Apps and Shortcuts for Your Terminal - (withfig.com) 图:终端的视觉应用和快捷方式 得分:42 | 评论:24 Loopy: a tool for thinking in systems - (ncase.me) Loopy:系统思维的工具 得分:176 | 评论:15 N. K. Jemisin’s Dream Worlds - (newyorker.com) N

发行版,distutils,setuptools和distutils2之间的区别?

杀马特。学长 韩版系。学妹 提交于 2020-07-24 17:06:10
问题: The Situation 情况 I'm trying to port an open-source library to Python 3. ( SymPy , if anyone is wondering.) 我正在尝试将开放源代码库移植到 Python3 。( SymPy ,如果有人想知道的话。) So, I need to run 2to3 automatically when building for Python 3. To do that, I need to use distribute . 因此,在为Python 3进行构建时,我需要自动运行 2to3 。为此,我需要使用 distribute 。 Therefore, I need to port the current system, which (according to the doctest) is distutils . 因此,我需要移植当前系统(根据doctest)是 distutils 。 The Problem 问题 Unfortunately, I'm not sure what's the difference between these modules— distutils , distribute , setuptools . 不幸的是,我不确定这些模块( distutils ,

SymPy substitute Symbol for Vector

橙三吉。 提交于 2020-07-22 05:05:27
问题 I have an expression of type Mul called term in the code below. Within term is a type Symbol called zhat . I want to perform something like term.subs(zhat, vec) where vec is of type BaseVector . I am subbing a symbol for a vector. The output is assigned to out_actual in the code. The issue is that out_actual is of type Mul when I need it to be of type VectorMul . The variable out_ideal is what I would expect from the substitution. Any way to obtain out_ideal ? import sympy as sp from sympy

SymPy substitute Symbol for Vector

纵饮孤独 提交于 2020-07-22 05:05:18
问题 I have an expression of type Mul called term in the code below. Within term is a type Symbol called zhat . I want to perform something like term.subs(zhat, vec) where vec is of type BaseVector . I am subbing a symbol for a vector. The output is assigned to out_actual in the code. The issue is that out_actual is of type Mul when I need it to be of type VectorMul . The variable out_ideal is what I would expect from the substitution. Any way to obtain out_ideal ? import sympy as sp from sympy

Color area beneath sympy function plot

佐手、 提交于 2020-07-21 05:24:09
问题 I have a sympy function, I want to plot it and color the area beneath the curve, how can I do it? Code import sympy as sy x = sy.symbols('x') f = sy.sin(x) sy.plot(f, (x, 0, sy.pi)) Plot 回答1: You can use plt.fill_between (documentation) but you need to convert your sympy function in a numpy array with sy.lambdify (documentation) before, because plt.fill_between takes in arrays. Check this code as a reference: import sympy as sy import numpy as np import matplotlib.pyplot as plt x = sy.symbols

Color area beneath sympy function plot

别说谁变了你拦得住时间么 提交于 2020-07-21 05:24:02
问题 I have a sympy function, I want to plot it and color the area beneath the curve, how can I do it? Code import sympy as sy x = sy.symbols('x') f = sy.sin(x) sy.plot(f, (x, 0, sy.pi)) Plot 回答1: You can use plt.fill_between (documentation) but you need to convert your sympy function in a numpy array with sy.lambdify (documentation) before, because plt.fill_between takes in arrays. Check this code as a reference: import sympy as sy import numpy as np import matplotlib.pyplot as plt x = sy.symbols

Color area beneath sympy function plot

我怕爱的太早我们不能终老 提交于 2020-07-21 05:23:12
问题 I have a sympy function, I want to plot it and color the area beneath the curve, how can I do it? Code import sympy as sy x = sy.symbols('x') f = sy.sin(x) sy.plot(f, (x, 0, sy.pi)) Plot 回答1: You can use plt.fill_between (documentation) but you need to convert your sympy function in a numpy array with sy.lambdify (documentation) before, because plt.fill_between takes in arrays. Check this code as a reference: import sympy as sy import numpy as np import matplotlib.pyplot as plt x = sy.symbols

Color area beneath sympy function plot

孤街浪徒 提交于 2020-07-21 05:23:01
问题 I have a sympy function, I want to plot it and color the area beneath the curve, how can I do it? Code import sympy as sy x = sy.symbols('x') f = sy.sin(x) sy.plot(f, (x, 0, sy.pi)) Plot 回答1: You can use plt.fill_between (documentation) but you need to convert your sympy function in a numpy array with sy.lambdify (documentation) before, because plt.fill_between takes in arrays. Check this code as a reference: import sympy as sy import numpy as np import matplotlib.pyplot as plt x = sy.symbols

Capture the output from function in real time python

吃可爱长大的小学妹 提交于 2020-07-19 11:15:26
问题 I didn't find quite what I was looking for. I want to obtain the output (stdout) from a python function in real time. The actual problem is that I want to plot a graph (with cplot from sympy) with a progress bar in my UI. The argument verbose makes cplot output the progress to stdout. sympy.mpmath.cplot(lambda z: z, real, imag, verbose=True) The output would be something like: 0 of 71 1 of 71 2 of 71 ... And so on. I want to capture line by line so I can make a progress bar. (I realize this

Multicolored Plot from SymPy

不羁的心 提交于 2020-07-17 12:33:12
问题 I'm trying to make a plot of the function x^2 in SymPy and want to overlay it with the lines x=3, y=9, and then also draw a circle around certain points. I've done all of the above with the code import sympy as sp x = sp.Symbol('x') # first plot the function sp.plotting.plot_parametric( (x, x**2, (x,0,4)), # then the straight lines (3, x, (x,0,16)), (x, 9, (x,0,4)), # then the circle (.1*sp.cos(x)+3.1, .1*sp.sin(x)+(3.1**2), (x,0,6.5)) ) However, all the curves are blue and I'd like to make