symbolic-math

how to construct sub-expressions with only two variables and one arithmatic operation from complex Expression Maple/Matlab?

let the Symbolic expression is as below. y = s + (a/b)*log((a+c)/(b*a)); %# it can be any type of expression how can I get all possible sub-expressions with two variables and one operator between them. subExpression1 = b*a; subExpression2 = a/b; I got stuck whlie extracting sub-expressions based on...

How to convert a string containing math expression into an integer? [duplicate]

This question already has answers here : How to evaluate a math expression given in string form? [closed] (24 answers) Closed 4 years ago . I have an array named questions array for String type that stores in the questions. I want to convert the questionArray[0] to an int . I have used the following...

If the input expression contains a symbolic variable, use the VPA function instead?

Im tring to substract the diagonal values with eigval and store the new value in the matrix Diagonal : CovarianceMatrix=[8 -3 1;2 1 0;3 4 5]; Col=3; Row=3; store=1; syms eigval; for loop1= Col:-1:1 Rw=1; syms eigval; for loop2= 1:Row if Rw==loop1 Diagonal= (CovarianceMatrix(Rw,loop1)-eigval); Fix...

Arithmetical operations on equations symbolicaly in R without yacas

I have equations defined like f<-"x^2" and g<-"y^2" . I want to obtain equation z like z<-(x^2)*(y^2) . 'Class(f)', 'class(g)' and 'class(z)' values doesn`t matter for me. I tried this: > f<-"x^2" > g<-"y^2" > z<-f*g I got: Error in f * g : non-numeric argument to binary operator<br/> I tried...

Beautifying the output of Matlab aka human-readable form for output?

syms x y z; solve(x==y+1, y^2==z,z==9) ans = x: [2x1 sym] y: [2x1 sym] z: [2x1 sym] and now I want to see the results like Mathematica outputting {{x->-2,y->-3,z->9},{x->4,y->3,z->9}} for Solve[{x == y + 1, y^2 == z, z == 9}, {x, y, z}] . The workspace window and then variable editor shows me this...

Can I change the formula of a symbolic function in MATLAB?

I have the following code: syms t x; e=symfun(x-t,[x,t]); In the problem I want to solve x is a function of t but I only know its value at the given t,so I modeled it here as a variable.I want to differentiate e with respect to time without "losing" x,so that I can then substitute it with x'(t)...

Use Matlab/Maple to find roots of a nonlinear equation

I am having difficulty in finding roots of a nonlinear equation. I have tried Matlab and Maple both, and both give me the same error which is Error, (in RootFinding:-NextZero) can only handle isolated zeros The equation goes like -100 + 0.1335600000e-5*H + (1/20)*H*arcsinh(2003.40/H) The variable is...

How to convert Mupad symbol &#39;I&#39; {sqrt(-1)} to &#39;i&#39; in matlab

I am trying to evaluate this integral in matlab matlab is treating 'ans' as a symbol because of 'I'. How to convert this 'I' into 'i' so that ans becomes a complex number. much appreciated! The symbolic math toolbox has an overloaded double function that can be used to convert from sym to double...

question about solving system of equations using symbolic math

I want to use symbolic symbol to solve a system of linear equation. So I prepare the following code. A=[1,2;3,4]; % syms x x=sym('x_%d',[2 1]); eqn=A*x==[1;2]; result=solve(eqn,x) Interestingly, it works, but when I read the variable result, it gives a 1X1 struct with x_1 and x_2 are 1X1 sym. But...