# symbolic-math

##### Matlab: How to specify input in matlabFunction?

matlabFunction() is a function that can convert symbolic to anonymous function. But how to specify what input arguments to be appeared on the anonymous function? For example, x = sym('x', [3, 1]) func = matlabFunction(x) It returns a handle with: func = function_handle with value: @(x1,x2,x3)[x1;x2;x3] But how to make this to be returned:? @(x) [x(1); x(2); x(3)] that the whole x is the input arguments, not every element of it. This could be extremely useful when x has very long colums.

2021-09-23 23:36:13    分类:问答    matlab   anonymous-function   symbolic-math

##### 格式短后，Matlab 不会缩短答案(Matlab wont shorten answer after format short)

2021-09-23 18:07:04    分类:技术分享    matlab   number-formatting   symbolic-math

##### Matlab wont shorten answer after format short

I'm trying to get matlab to shorten the answer into scientific notation but it continues to display long numbers. Here is my matlab script: syms E; kb=8.617e-5; %eV/k h=4.136e-15; %eV*s Ts=5760; %k q=1; %ev c=3.0e8; %m/s theta_s=atan(7e8/1.5e11); %rad format short Il_per_area = (q*pi/2)*(1-cos(2*theta_s))*int(((2/h^3*c^2)*E^2)/(exp(E/(kb*Ts-1))),E) This is the result matlab gave me: Il_per_area = (52508430427297951419542428146127404493579145286547868195529063488882991519987*exp((2251799813685248*E)/1134143295600563)*((5070602400912917605986812821504*E^2)/1286281014955706024710845916969 -

2021-09-23 11:35:13    分类:问答    matlab   number-formatting   symbolic-math

##### 在传递给 sum() 之前强制评估索引表达式(Force evaluate index expression before passing to sum())

2021-09-23 09:43:33    分类:技术分享    symbolic-math   quote   maxima   computer-algebra-systems

##### Julia 在循环中更改名称，使用符号变量(Julia changing name in loop, using symbolic variables)

2021-09-21 17:53:14    分类:技术分享    julia   sympy   symbolic-math

##### 用符号表达式替换函数的导数(substitute the derivative of a function in a symbolic expression)

2021-09-15 21:39:39    分类:技术分享    matlab   symbolic-math

##### 如何在 Matlab 中简化符号和数字混合表达式(How to simplify a symbolic and numeric mixed expression in Matlab)

2021-09-13 10:51:45    分类:技术分享    matlab   numeric   symbolic-math

##### Error while evaluating the function convolution

This is my first attempt to write anything in matlab, so please, be patient. I am trying to evaluate the solution of the following ODE: w'' + N(w, w') = f(t) with the Cauchy conditions w(0) = w'(0) = 0. Here N is a given nonlinear function, f is a given source. I also need the function where G is the solution of the following ODE: where G(0) = G'(0) =0, s is a constant, and My try is as follows: I define N, f, w and G: k = 1000; N = @(g1,g2) g1^2 + sin(g2); f = @(t) 0.5 * (1 + tanh(k * t)); t = linspace(0, 10, 100); w = nonlinearnonhom(N, f); G = nonlinearGreen(N); This part is ok. I can plot

2021-09-05 17:36:03    分类:问答    matlab   symbolic-math

##### fast evaluation of analytical jacobian in MATLAB

I have formulated a optimization problem that requires a very fast evaluation of the Jacobian matrix. I calculated the Jacobian analytically from my constraints using MATLAB's symbolic toolbox. I need an analytical Jacobian so that it is accurate (and I was thinking it would be fast, but that is not the case with my current implementation). This part of the code is calculated once and the result J, is saved and then loaded in the next part % symbolic variables dvs = 5; X=sym('X',[dvs,1]); % multiple functions for k = 1:4 f1(X(k+1),X(k)) = (X(k+1) - X(k)); c(k) = f1; end J = jacobian(c,X); x =

2021-09-05 11:23:45    分类:问答    matlab   symbolic-math

##### SymPy: Can I safely differentiate atan2()?

I would like to obtain a symbolic expression which is the derivative of atan2(y,x), where y and x are some expressions with a variable z. Can I safely assume that diff(atan2(y,x),z) gives me what I want? In math.stackexchange.com there is a proof that atan2 is continuously differentialable in (-pi,pi), but is it in SymPy?

2021-09-05 06:01:34    分类:问答    python   python-3.x   sympy   symbolic-math