symbolic-math

RegEx for Mathematical Alphanumeric Symbols

一个人想着一个人 提交于 2019-12-07 08:45:49
问题 I have been trying to remove bold characters like this: 𝐒𝐎𝐍𝐘𝐀 - New song As you see is a bold text without <b> tag. I had tried this, assuming that the characters are probably a type of emoticon, but I have not had any luck. $regex_emoticons = '/[\x{1F600}-\x{1F64F}]/u'; $clear_string = preg_replace($regex_emoticons, '', $string); $regex_symbols = '/[\x{1F300}-\x{1F5FF}]/u'; $clear_string = preg_replace($regex_symbols, '', $clear_string); $regex_transport = '/[\x{1F680}-\x{1F6FF}]/u'; $clear

Symbolic Math Toolbox hitting divide by zero error when it used to evaluate to NaN

北城余情 提交于 2019-12-07 08:08:44
问题 I've just updated to Matlab 2014a finally. I have loads of scripts that use the Symbolic Math Toolbox that used to work fine, but now hit the following error: Error using mupadmex Error in MuPAD command: Division by zero. [_power] Evaluating: symobj::trysubs I can't post my actual code here, but here is a simplified example: syms f x y f = x/y results = double(subs(f, {'x','y'}, {1:10,-4:5})) In my actual script I'm passing two 23x23 grids of values to a complicated function and I don't know

Sympy: Drop higher order terms in polynomial

▼魔方 西西 提交于 2019-12-07 01:35:50
问题 Using Sympy, say we have an expression f, which is a polynomial of the Symbol "x" (and of potentially other symbols). I would like to know what if there is an efficient way to drop all terms in f of order greater than some integer n. As a special case I have a very complicated function but i want to only keep terms up to 2nd order in x. What's the efficient way to do this? The obvious, not-very-efficient way to do it would be for each m less than n, take m derivatives and set x to 0 to obtain

How to access symbolic expression based on arithmetic operators MATLAB

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-06 15:56:32
问题 The symbolic expression below is one example out of many expressions expr = x + (x/z)*log(C + x/y); for the above expression I need to solve as below STEP 1: var1 = x/y % accessing expression one operation at a time result1 = applySomeFunction(var1) STEP 2: var2 = var1+C result2 = someConstantValue*result1+ applySomeFunction(var2); STEP 3: var3 = log(var2) result3 = someConstantValue*result2 + applySomeFunction2(var3); Step4: var4 = var3*x result4 = someConstantValue*result3 +

Factor sympy expression to matrix coefficients?

佐手、 提交于 2019-12-06 07:02:01
问题 I have tried to be diligent in looking through documentation and am coming up empty. I am trying to factor or eliminate terms in a expression to matrix form. My problem appears to differ from polynomial factoring (as I plan to implement a function phi(x,y,z) = a_1 + a_2*x + a_3*y + a_4*z ) import sympy from sympy import symbols, pprint from sympy.solvers import solve phi_1, phi_2, x, a_1, a_2, L = symbols("phi_1, phi_2, x, a_1, a_2, L") #Linear Interpolation function: phi(x) phi = a_1 + a_2*x

Simplifying a very long symbolic expression by automatically introducing temporal variables or in any other way

末鹿安然 提交于 2019-12-05 22:47:17
问题 After attempting to solve a symbolic math problem, I got an expression with about 17000 characters. I am using the symbolic toolbox for Matlab, but I am open to any suggestion (Mathematica, whatever). For obvious reasons, I won't copy-paste the expression straight into the question. Here is a link instead. Running the Matlab commands simplify and simple , and even attempts to collect didn't improve the situation (Some got it worse). But I am wondering, I don't care if the expression is

How to use sympy.physics.quantum Commutator?

送分小仙女□ 提交于 2019-12-05 21:44:20
I want to work out some commutator manipulations and found this tool in sympy. It appears to work as expected (but the documentation is virtually non-existent or at least I found little, but see the comment by Dalton Bentley below), but I ran into the following problem. from sympy.physics.quantum import Commutator as Comm from sympy.physics.quantum import Operator A = Operator('A') B = Operator('B') C = Comm(Comm(Comm(A,B),A),B) D = Comm(Comm(Comm(A,B),B),A) E = (C-D).expand(commutator=true) E >>> [[[A,B],A],B] - [[[A,B],B],A] instead of the expected simpler result 0 (since [[[A,B],A],B] = [[

Using the Pochhammer Symbol in Matlab

﹥>﹥吖頭↗ 提交于 2019-12-05 21:37:07
This question was migrated from Software Engineering Stack Exchange because it can be answered on Stack Overflow. Migrated 6 years ago . I've tried to use a script that evaluates the Pochhammer symbol (rising factorial) in Matlab, but it fails to evaluate pochhammer(x,n) whenever x is a negative number even though the expression is valid when x is negative (Wolfram Alpha and Mathematica give answers for Pochhammer(-3,2) ). Can anyone help me get pochhammer working in Matlab for negative arguments? I assume that you're referring to this Pochhammer function . Note that pochhammer (not

Symbolic Mathematics for .NET

為{幸葍}努か 提交于 2019-12-05 05:51:06
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? This might be overkill, but you can talk to Mathematica from .NET, using its .NET/Link API . 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/770064/symbolic-mathematics-for-net

Maxima: convert matrix to list

旧街凉风 提交于 2019-12-05 02:01:52
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 ? 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]] Simon I'm far from a Maxima expert, but since you asked me to look at this question , here's what I have after a quick look through the documentation . First, looking at the documentation on matrices yielded only one way