Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 09:38
    insaneyilin starred sympy/sympy
  • 08:52
    TH3CHARLie starred sympy/sympy
  • 08:46
    schymans commented #16778
  • 07:44
    sympy-bot commented #18042
  • 07:44
    asmeurer edited #18042
  • 07:44
    sympy-bot commented #18042
  • 07:44
    asmeurer edited #18042
  • 07:29
    czgdp1807 commented #9835
  • 07:24
    czgdp1807 unlabeled #9809
  • 07:23
    czgdp1807 closed #9505
  • 07:23
    czgdp1807 commented #9505
  • 07:07
    czgdp1807 unlabeled #9436
  • 07:07
    czgdp1807 labeled #9436
  • 07:04
    czgdp1807 unlabeled #9314
  • 07:03
    czgdp1807 commented #8167
  • 06:58
    czgdp1807 closed #9038
  • 06:58
    czgdp1807 commented #9038
  • 06:52
    czgdp1807 unlabeled #8842
  • 06:52
    czgdp1807 labeled #8842
Kalevi Suominen
@jksuom
You can probably find a solution if you remove one of the equations.
Het Patel
@hetp111
is NumPy related to sympy?
i am learning python megacourse on udemy and it is also teaching numpy, so i was wondering if it might be useful
Igor Morgado
@igormorgado
@hetp111 not related but can work together.
V Gladkova
@valglad
The lack of solutions is definitely a precision issue - if you input all entries as Rational (e.g. Rational(1,2) instead of 1/2), then linsolve returns the same as Maple (though obviously that's awkward)
V Gladkova
@valglad

A potential solution could be to define

rationalize = lambda x: [nsimplify(e) for e in x]

(this will turn numbers from a list into rationals). And then do

PI = Matrix(map(rationalize, [
    [-11/12, 1/24, 0, 0, -1],
    [ 17/24, -9/8, 1/24, 0 ,5],
    [3/8, 9/8, -9/8, 1/24, -10],
    [-5/24, -1/24, 9/8, -9/8, 10],
    [1/24, 0, -1/24, 9/8, -5],
    [0, 0, 0, -1/24, 1]
]))

and similarly for c. I've just checked and this returns the right solutions

Igor Morgado
@igormorgado
@jksuom I cant remove any variable unfortunately.
@valglad Amazing! I will test.
Kalevi Suominen
@jksuom
Do not remove any variables. There are too few already. Remove one of the equations.
There are 6 rows and only 5 columns. One row could be omitted.
Igor Morgado
@igormorgado
@jksuom I can't either, they are strict contraints in my solution space.
Kalevi Suominen
@jksuom
If there is a solution, then the same solution is obtained after one equation is omitted.
Kalevi Suominen
@jksuom
In [7]: linsolve(Pc[:5, :])
Out[7]: 
{(1.12549831271091, 0.749071392102014, 1.16564957508439, 0.96140585029474, -0.
000620954287620833)}
Igor Morgado
@igormorgado
@valglad Thanks. rationalize function worked (in fact I was using Fractions.from_float() before, this work better). But I could not apply your lambda function to a 2-d matrix, just 1-d.
I have created mrationalize = lambda x: [nsimplify(e) for e in [r for r in x]] that I do not like much the fell.
V Gladkova
@valglad
Doing map(rationalize, list_of_lists) inside the Matrix call (like I did above when creating PI) would probably be easiest
Adoa Coturnix
@adoa

I have a problem with calculating eigenvectors for a simple 3x3 matrix in sympy. Trying to execute

q = symbols("q", positive=True)
m = Matrix([[-2, exp(-q), 1], [exp(q), -2, 1], [1, 1, -2]])
#m.eigenvects(simplify=True)
m.eigenvals()

results in very complicated expressions for the eigenvalues, trying to get the eigenvectors fails with a NotImplementedError. I expect the latter to be due to the former. However, when trying to do the same thing in Mathematica, I get much simpler expressions for everything. Is there some option / flag that I can set to have sympy compute these eigenvalues and eigenvectors? Is there currently some form of limitation within sympy that prevents me from doing this?

Het Patel
@hetp111
what are all the prerequisite i need to have before contributing to opensource (sympy) ? I have a pretty good hold of python now. Github is very confusing for me.
Aaron Meurer
@asmeurer
It helps to understand git/github, but generally the best way to learn them is to use them
@adoa does Mathematica give a simpler expression for the eigenvalues?
Oh apparently they can be simplified if you call simplify
Het Patel
@hetp111
@asmeurer Ty, do i need to learn git or github? is learning github enough? i have never done opensource before, should i start with sympy?
Aaron Meurer
@asmeurer
You need to learn the basics of git, to download the code and push it up to GitHub
@adoa it seems there is a simplify flag, but it doesn't work
Het Patel
@hetp111
@asmeurer can't i do it manually through github website?
Kalevi Suominen
@jksuom
I suspect that there is not enough support for simplifying hyperbolic functions.
This may help you
Aaron Meurer
@asmeurer
@adoa I opened sympy/sympy#15118 for your issue
Het Patel
@hetp111
@Malkhan52 Thank ypu,
Aaron Meurer
@asmeurer
Het Patel
@hetp111
@asmeurer I am using windows, will i have any problems? or do i need linux?
Aaron Meurer
@asmeurer
You can use windows.
You should use whichever you feel more comfortable with
Het Patel
@hetp111
I am aiming for GSoC 2019, what is the procedure?
(sorry for these silly questions... I am trying my best ,i just need some guidance )
Malkhan Singh
@Malkhan52

I'm getting this error '''>>> expr = cos(x)

expr.subs(x-1,y)
cos(x)
expr = cos(x+1)
expr.subs(x-1,y)
cos(y + 2)
'''

where will it be in code?

Aaron Meurer
@asmeurer
Somewhere in the core
I guess it's because Add does the smart substitution but Symbol does not
The cosine is irrelevant. It's the same with x.subs(x - 1, y) vs. (x + 1).subs(x - 1, y)
Malkhan Singh
@Malkhan52
yeah that's why i'm searching subs()
Malkhan Singh
@Malkhan52
got that in basic.py
Aaron Meurer
@asmeurer
Subs is implemented on the different classes in _eval_subs
So Symbol._eval_subs should do the same thing as Add._eval_subs.
Adoa Coturnix
@adoa
@asmeurer: I am somewhat confused regarding the simplification. Apparently there is a difference between simplify(a_list) and [simplify(element) for element in a_list]. With the latter, I get the same expressions as in Mathematica, the former does not simplify at all o_O. In any case: thanks for opening the issue :-)
Aaron Meurer
@asmeurer
I don't know why simplify returns a list unchanged. In general, though, you shouldn't rely on SymPy functions automatically vectorizing over lists
Ashwin Shenoy
@Ashwin-Shenoy-NITK
In the ellipse class, do hradius & vradius represent the semi-major axis length & semi-minor axis length respectively ?
It's a bit unclear in the docstring. I take it they are being represented as radius vectors from the origin along the major & minor axis ?
Akshit Srivastava
@akshitt
Hi I am Akshit, fresher in CS at Indian Institute of Technology, Bombay. Could someone guide me to a basic level bug to start with?
I have some basic level knowledge in Python, FLINT, NumPy