Questions tagged [symbolic-math]

Symbolic math tools allows for analytically process mathematical expressions - without the necessity of assigning specific numeric values to variables.

Common software that allows for symbolic math operations include

See this comparison of computer algebra systems (CAS) for other software packages that support symbolic math operations.

Online examples of Computer Algebra System

1493 questions
5
votes
1 answer

ODE solver from Lagrangian/Variational Methods in C++

I have a general question which I will phrase in the context of a more concrete situation. If one wants to find the dynamics of a double pendulum, one can mathematically derive the equations of motions, rewrite the ODEs to have a special form useful…
Heidar
  • 159
  • 1
5
votes
1 answer

Julia changing name in loop, using symbolic variables

I'd like to change the name of a symbolic variable in each iteration of a loop, and then solve an equation using these symbolic variables e.g: using SymPy for i in 1:5 p{i} = symbols("p"{i}, real=true,positive=true) solve(p{i}^2-i^2) end So I'm…
5
votes
2 answers

MATLAB subs(): Strange behaviour

syms Gr Ra Ri A B Gr1 Gr2 c d Gr = 2*c*(Ra^2 - Ri^2) - d*(Ra^4 - Ri^4)/2; Gr1 = subs(Gr, [c*(Ra^2 - Ri^2), -d*(Ra^4 - Ri^4)/2], [A, B]) Gr2 = subs(Gr, [c*(Ra^2 - Ri^2), d*(Ra^4 - Ri^4)/2], [A, B]) returns Gr1 = 2*A + B Gr2 = 2*A - (d*(Ra^4 -…
Thomas
  • 67
  • 7
5
votes
1 answer

How is a symbolic value stored in Matlab

A symbolic value occupies 112 bytes of memory with Matlab (Symbolic Math toolbox). One can see this via the whos command. I know that a floating-point value (in the numerical framework of Matlab) is stored according to the IEEE 754 standard. So,…
manifold
  • 233
  • 2
  • 9
5
votes
1 answer

Mix of Matrix and Scalar symbols

Is there a way to mix Matrix symbols and scalar symbols in Sympy? I want to make a scalar function that takes vectors and scalars for example: import sympy as sy v=sy.MatrixSymbol('v',3,1) f=v.T*v+5 I receive an error saying: TypeError: Mix of…
João Abrantes
  • 4,772
  • 4
  • 35
  • 71
5
votes
2 answers

More than one module for lambdify in sympy

I am trying to make lambdify understand to expect more than one type of input using the modules keyword argument. According to the source code of lambdify (http://docs.sympy.org/dev/_modules/sympy/utilities/lambdify.html), this can be done by using…
krishna
  • 135
  • 1
  • 7
5
votes
2 answers

How do I evaluate a Symbolic variable in SymbolicC++?

I have been trying out a couple computer algebra libraries for C++ to use with a vector calculus course I am taking. I am having trouble with nonlinear equations in GiNaC and in SymbolicC++ it actually worked. Here is a simple example, but the…
5
votes
1 answer

what is wrong with symbolic assignment?

I have big code and i noticed a bug in my code without any syntax error. I describe it using the following example: I=sym(eye(3)); %I is Identity 3by3 a=sym(zeros(5,1)); %a is column matrix then : a(1)=I; which should give an error but the result…
milad
  • 169
  • 1
  • 2
  • 10
5
votes
1 answer

How to stop the Matlab from rearranging symbolic variables?

This symbolic expression in Matlab syms x y; f = x * y * y returns f = x*y^2 How can I stop Matlab from simplifying the expression and let it remain as x * y * y? I'm trying to print the steps of a calculation this way, so reordering the terms…
semekh
  • 3,867
  • 2
  • 24
  • 34
5
votes
2 answers

Algorithm to invert strings of algebraic expressions in Python

Is there an easy way to make a function to inverse an algorithm for example like this: >>> value = inverse("y = 2*x+3") >>> print(value) "x = (y-3)/2" If you can't make actual code for the function, please recommend me tools that would make this…
vuolen
  • 464
  • 4
  • 12
5
votes
2 answers

How can I give a number to a symbolic variable in MATLAB?

I try to declare a symbolic variable in MATLAB with this code: syms a; I do my computation on this variable and all thing is fine. But my problem is that, I don't know how can I give a number to variable and get the result as a number. For example…
peaceman
  • 1,499
  • 2
  • 17
  • 29
4
votes
2 answers

R: trouble making package Ryacas to work on Windows

I am trying to use the package Ryacas in R. Here what is going on: > install.packages("Ryacas") --- Please select a CRAN mirror for use in this session --- trying URL 'http://www.stats.bris.ac.uk/R/bin/windows/contrib/2.14/Ryacas_0.2-11.zip' Content…
yCalleecharan
  • 4,656
  • 11
  • 56
  • 86
4
votes
1 answer

Evaluate a symbolic Ryacas expression

This is a reproducible example: a <- 0.05 za.2 <- qnorm(1-a/2) b <- 0.20 zb <- qnorm(1-b) lambda12 <- -log(1/2)/12 lambda18 <- -log(1/2)/18 theta <- lambda18/lambda12 (d = round(4*(za.2+zb)^2/log(theta)^2)) Tf<-36 library(Ryacas) n <-…
gd047
  • 29,749
  • 18
  • 107
  • 146
4
votes
2 answers

Matlab's simplify behavior

I'm trying to simplify some symbolic equations. >> syms x; >> simplify(sqrt(x^2)/x) ans = (x^2)^(1/2)/x Actually, I want matlab to return 1 or smth like that. >> simplify((x^9+7*x^8-2*x-6)/(x-1)) ans = -(- x^9 - 7*x^8 + 2*x + 6)/(x - 1) 1 is a…
4
votes
0 answers

How to translate (-Csch[x]^2)^(1/2) to Julia symbolic? ERROR: DomainError with -csch

Fyi, Just in case this is a bug in Julia symbolic, added new issue at https://github.com/JuliaSymbolics/Symbolics.jl/issues/719 I am trying to translate the following. In Mathematica In Maple: To Julia symbolics. Where csch is hyperbolic cosecant…
Nasser
  • 12,849
  • 6
  • 52
  • 104