symbolic-math

Symbolic Mathematics for .NET

核能气质少年 提交于 2019-12-22 05:09:15
问题 I am looking for symbolic mathematics library for .NET framework. I have looked at Math.net but it's not something usable yet. Do you know if there is another library exists? 回答1: This might be overkill, but you can talk to Mathematica from .NET, using its .NET/Link API. 回答2: Symbolism is a library which implements automatic simplification of algebraic expressions in C#. It can be used as a foundation for more complex symbolic mathematics operations. 来源: https://stackoverflow.com/questions

Is there a vectorized way to calculate the gradient in sympy?

自古美人都是妖i 提交于 2019-12-22 04:04:14
问题 How does one calculate the (symbolic) gradient of a multivariate function in sympy? Obviously I could calculate separately the derivative for each variable, but is there a vectorized operation that does this? For example m=sympy.Matrix(sympy.symbols('a b c d')) Now for i=0..3 I can do: sympy.diff(np.sum(m*m.T),m[i]) which will work, but I rather do something like: sympy.diff(np.sum(m*m.T),m) Which does not work ("AttributeError: ImmutableMatrix has no attribute _diff_wrt"). 回答1: Just use a

Maxima: convert matrix to list

大兔子大兔子 提交于 2019-12-22 03:58:45
问题 I convert list to matrix in Maxima in following way: DataL : [ [1,2], [2,4], [3,6], [4,8] ]; DataM: apply('matrix,DataL); How to do it the other way ? How to convert given matrix DataM into list DataL ? 回答1: I know it's late in the game, but for what it's worth, there is a simpler way. my_matrix : matrix ([a, b, c], [d, e, f]); my_list : args (my_matrix); => [[a, b, c], [d, e, f]] 回答2: I'm far from a Maxima expert, but since you asked me to look at this question, here's what I have after a

Symbolic Math Library in C/C++/Obj-C [closed]

主宰稳场 提交于 2019-12-21 18:15:10
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . I am trying to implement a graphing calculator on the iPhone. I am looking for a library that can take strings of expressions or functions and let me manipulate them (find derivatives, intercepts, zeros, etc). Does anything like this exist? 回答1: There's GiNaC for C++. GPL-licensed and actively maintained, last

Non-sequential substitution in SymPy

余生颓废 提交于 2019-12-21 03:38:40
问题 I'm trying to use [SymPy][1] to substitute multiple terms in an expression at the same time. I tried the [subs function][2] with a dictionary as parameter, but found out that it substitutes sequentially. In : a.subs({a:b, b:c}) Out: c The problem is the first substitution resulted in a term that can be substituted by the second substitution, but it should not (for my cause). Any idea on how to perform the substitutions simultaneously, without them interfering with each other? Edit: This is a

How to find a function's rth derivative when r is symbolic in Mathematica?

可紊 提交于 2019-12-20 09:56:00
问题 I have a function f(t)=2/(2-t) . It is not so hard to get the rth derivative at t=0 (i.e. 2^(-r)*r! ) without using Mathematica. In the case of Mathematica calculation, I can get the r-th derivative when r=4 like this: D[2/(2-t), {t, 4}] . But how can I get the rth derivative at t=0 in Mathematica when r is ANY integer? I tried to use this expression, but it didn't work as expected: Simplify[D[2/(2 - t), {t, r}], Assumptions -> Element[r, Integers]] /. {t->0} Is it possible to do the above

Laguerre polynomials in MATLAB

时光毁灭记忆、已成空白 提交于 2019-12-20 04:45:07
问题 I tried using the .. command in MATLAB to generate Laguerre polynomials but I keep getting this error every time: I found this in the help section: Since I have defined x as symbolic I shouldn't be getting this error. Also on website I found this which says that the function does not run in MATLAB. Can anyone help? Thanks in advance 回答1: Like you say, and the matlab help says this function only works inside mupad, maybe in later versions it works in matlab console. If you want to use it,

Issue with Matlab solve function?

大城市里の小女人 提交于 2019-12-20 03:22:11
问题 The following command syms x real; f = @(x) log(x^2)*exp(-1/(x^2)); fp(x) = diff(f(x),x); fpp(x) = diff(fp(x),x); and solve(fpp(x)>0,x,'Real',true) return the result solve([0.0 < (8.0*exp(-1.0/x^2))/x^4 - (2.0*exp(-1.0/x^2))/x^2 - (6.0*log(x^2)*exp(-1.0/x^2))/x^4 + (4.0*log(x^2)*exp(-1.0/x^2))/x^6], [x == RD_NINF..RD_INF]) which is not what I expect. The first question: Is it possible to force Matlab's solve to return the set of all solutions? (This is related to this question.) Moreover,

Printing syms / matlabFunction slow

给你一囗甜甜゛ 提交于 2019-12-19 19:56:49
问题 I am having a lot of trouble trying to make symbolic substitution go faster - that is, substituting in for variables in a symbolic expression and getting out a double. I am creating a complicated function f, and calculating its jacobian df. This goes at a reasonable pace, and I can save it to a file just fine. But when I try to use matlabFunction or even disp or fprintf, the system hangs and is unable to proceed further (even when matlabFunction is set to unoptimized). This is a major problem

Speeding up computation of symbolic determinant in SymPy

自古美人都是妖i 提交于 2019-12-19 19:12:31
问题 I have a 4x4 matrix A with rather long but simple symbolic expressions in each of its entries. About 30 different symbols are involved. By "simple" I mean that these symbols are combined using only addition/subtraction, multiplication/division, and integer powers. By "long" I mean that if I print out the matrix, it covers three or four screens worth. I need the determinant of this matrix. Or, to be more specific, I know that the determinant is a fourth-order polynomial in one particular