A computer algebra system written in pure Python http://sympy.org/ . To get started to with contributing https://github.com/sympy/sympy/wiki/Introduction-to-contributing
oscargus on master
Improved documentation formatti… Updated documentation Sympy to SymPy and 4 more (compare)
@ThePauliPrinciple
My function is
U_n= x^n + 1/x^n.
As an example when I compute (U_1)^3 I get (x^3 + 1/x^3) + 3(x+ 1/x).---------(i)
And if I compute (U_2)^2 I get x^4 + 1/x^4 + 2---------(ii)
But since in (i), (x^3 + 1/x^3)= U_3 and 3(x+ 1/x)=3U_1 I want to get the answer U_3+3U_1.
In (ii) I want to get the answer U_4 +2 since x^4 + 1/x^4 = U_4.
aman@amanUBUNTU:~/Desktop$ python3 Un.py
Enter Value of n and k as in (U_n)^k
n = 1
k = 3
3*U_1 + U_3
aman@amanUBUNTU:~/Desktop$ python3 Un.py
Enter Value of n and k as in (U_n)^k
n = 1
k = 2
U_2 + 2
aman@amanUBUNTU:~/Desktop$ python3 Un.py
Enter Value of n and k as in (U_n)^k
n = 2
k = 10
45*U_12 + 10*U_16 + U_20 + 210*U_4 + 120*U_8 + 252
@mostlyaman Yes.This is kind of same what I want.But in my case it is bit advanced.
U(n)=x^n + 1/x^n
V(n)=x^n - 1/x^n
So if I ask for any expression I should get the answer in U(n)'s and V(n)'s.I have buil it for U(n) and V(n) separately but cannot combine them.
ex: u(1)v(1)=v(2)
v(2)u(1)-v(1)=v(3)
v(1)^2 - u(1)^2 =2*u(2)
This is the program which I want.
@mostlyaman is your program executable in jupyter notebook?. If you have an idea please let me know.
dr = symbols('Delta',real=True,positive=True,nonzero=True)
and k = symbols('k',integer=True,real=True)
@AbhJ Welcome! Please have a look at https://github.com/sympy/sympy/wiki/Introduction-to-contributing and the Easy-to-fix issues https://github.com/sympy/sympy/issues?q=is%3Aopen+is%3Aissue+label%3A%22Easy+to+Fix%22
Note that there are many issues that have some PR already proposed. It makes sense to have a look at those (or pick one without any solution proposed) and see why they didn't get merged yet (maybe because a test is missing or the documentation not updated or something else). If you decide to use a solution attempt from any of them, please make sure that you build on that PR and do not just copy and paste the code.
>>> import sympy
>>> n = sympy.symbols("n")
>>> x = sympy.Subs(1.0, n, 1)
>>> y = sympy.Subs(1.0, n, 2)
>>> x + y
Traceback (most recent call last):
# Shortened for clarity
File "/mnt/c/Users/migue/Source/Equator/.venv_linux/lib/python3.8/site-packages/sympy/logic/boolalg.py", line 211, in _noop
raise TypeError('BooleanAtom not allowed in this context.')
TypeError: BooleanAtom not allowed in this context.
During handling of the above exception, another exception occurred:
# Shortened for clarity
Traceback (most recent call last):
File "/mnt/c/Users/migue/Source/Equator/.venv_linux/lib/python3.8/site-packages/sympy/logic/boolalg.py", line 211, in _noop
raise TypeError('BooleanAtom not allowed in this context.')
TypeError: BooleanAtom not allowed in this context.
n
in the substitution then it works completely fine>>> x = sympy.Subs(n, n, 1)
>>> y = sympy.Subs(n, n, 2)
>>> x + y
Subs(n, n, 1) + Subs(n, n, 2)
'Build finished; the LaTeX files are in _build/latex.
Set the environment variable LATEXMKOPTS='-xelatex -silent'
And run `make all' in that directory to run these through xelatex.
latexmk -pdf -dvi- -ps- 'sympy-1.10.dev.tex'
Latexmk: This is Latexmk, John Collins, 26 Dec. 2019, version: 4.67.
Latexmk: applying rule 'pdflatex'...
! Fatal Package fontspec Error: The fontspec package requires either XeTeX or
(fontspec) LuaTeX.
(fontspec)
(fontspec) You must change your typesetting engine to,
(fontspec) e.g., "xelatex" or "lualatex"instead of
(fontspec) "latex" or "pdflatex".
Type <return> to continue.
...
l.45 \msg_fatal:nn {fontspec} {cannot-use-pdftex}'