Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 21:54
    Jaime02 commented #18358
  • 21:53
    sympy-bot commented #18728
  • 21:53
    oscarbenjamin opened #18728
  • 21:51
    Jaime02 closed #17967
  • 21:51
    Jaime02 commented #17967
  • 21:43
    oscarbenjamin commented #16149
  • 21:36
    sympy-bot commented #16149
  • 21:36
    asmeurer edited #16149
  • 21:36
    sympy-bot commented #16149
  • 21:36
    asmeurer edited #16149
  • 21:36
    sympy-bot commented #16149
  • 21:36
    asmeurer edited #16149
  • 21:32
    sympy-bot commented #18358
  • 21:32
    Jaime02 synchronize #18358
  • 21:31
    asmeurer edited #16149
  • 21:29
    Jaime02 synchronize #18358
  • 21:26
    sympy-bot commented #18358
  • 21:26
    Jaime02 synchronize #18358
  • 21:24
    codecov[bot] commented #18682
  • 21:24
    asmeurer edited #16149
V Gladkova
@valglad
Ah, well, actually the next link it gives is to a video tutorial
Het Patel
@hetp111
Okay... and what tools should i use?
i am using windows. cant get linux on my machine, having some trouble...
i hope windows is fine, is it?
V Gladkova
@valglad
SymPy is not OS-dependent, it'll work on anything that has Python. How do you normally run python scripts? Using SymPy is no different
You just need to import it before you can use it
import sympy or from sympy.<some module> import <some function>
Het Patel
@hetp111
Thanks, so i am using python idle and pycharm, but when i run sympy, it is not showing symbol like e^x, rather it shows exp(x). how to fix this?
Het Patel
@hetp111
i meant to say that it is not showing symbols
V Gladkova
@valglad
init_printing() should do it. Have a look at http://docs.sympy.org/latest/tutorial/printing.html
Het Patel
@hetp111
Thanks! But in python idle and pycharm i get the same old result
Kalevi Suominen
@jksuom
I think that python idle and pycharm show python code. The meaning of symbols like e^x is different from exp(x) because ^ is used to denote exclusive or.
Aaron Meurer
@asmeurer
init_printing() should work in pycharm if it uses the sys.displayhook
Het Patel
@hetp111
ok thanks! i'll try
Het Patel
@hetp111
does sympy use python 2 or 3?
Sidhant Nagpal
@sidhantnagpal
SymPy is a Python library. It supports both Python 2 and Python 3.
It uses Python 3 for implementation (backward compatibility is maintained).
Het Patel
@hetp111
Thanks!
Ashwin Shenoy
@Ultra-Instinct-05
Hi guys,
Manthan
@Mac2301
hi
Ashwin Shenoy
@Ultra-Instinct-05

I was just setting up my environment. I used git fetch upstream in order to sync my local repo with the master but I am getting this error: git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Is it something regarding SSH Keys ?
I have configured remote with git remote -v & git remote add upstream git@github.com:sympy/sympy.git & there eas no errors.
V Gladkova
@valglad
It could be to do with ssh keys. You could check if your key is setup properly as described here
Ravi charan
@RavicharanN

@Ashwin-Shenoy-NITK How exactly are you specifying the upstream?

'Coz git remote add upstream git@github.com:sympy/sympy.git might throw that error as you don't own the repository and you won't have the access rights.

If that is the case, you could simply use git remote add upstream https://github.com/sympy/sympy there.

Igor Morgado
@igormorgado
Hello there
I'm using sympy to solve some linear systems in my finite difference model (since I need nullspaces, I cannot use numpy least square directly).
Also since I don't know beforehand the size of my linear system (not big for now, not bigger than 10 variavles). I'm solving it without specify the "symbols" because I really don't care.
the line to solve is simpleand looks like linsolve(Matrix(np.c_[V,o])).
in this specific case (i think 6 variables involved), I got a free variable as response {(-1.0*tau0 - 0.916666666666667, 5.0*tau0 + 0.708333333333333, -10.0*tau0 + 0.375, 10.0*tau0 - 0.208333333333333, -5.0*tau0 + 0.0416666666666667, tau0)}, seems is autonamed tau0
I want to eval tau0 = 0, but without know the variable name before hand.
something like lin(Matrix(np.c_[V, o])) | all_free_variables = 0
Igor Morgado
@igormorgado
where | all_free_variables = 0 is a poetry freedom on python language, since I don't know how to do that
r.evalf(subs={tau0: 0}) doesn't works, and also ) don't want to specify the variable name, since I will not know beforehand
neither r.subs(tau0, 0), both complain about tau0 not being defined
Igor Morgado
@igormorgado

doing:
tau0 = symbols('tau0'); r.subs(tau0,0)

works. But I must know before hand each symbol. That I don't. =/

Igor Morgado
@igormorgado

I solved the issue with

r_tmp = linsolve(Matrix(np.c_[V[j], o]))
for symbol in list(r_tmp.free_symbols):
    r_tmp = r_tmp.subs(symbol,0)
mysolution = np.array(list(r_tmp)).ravel().astype(float)

Any smarter solution?

the mysolution is a numpy array as you could notice.
Kalevi Suominen
@jksuom
@igormorgado The docstring of linsolve says:
This message was deleted
If no symbols are given, internally generated symbols will be used.
It seems that you can give the names that you would like to use instead of the generated names like tau0.
Igor Morgado
@igormorgado
@jksuom But I cannot specify the names,since I don't know how many free vars will exist.
@jksuom in fact, I don't even know the size of the matrix beforehand. It will depend on size of the grid loaded. can have 500 variables.
V Gladkova
@valglad

@igormorgado That seems like a good enough solution, though I would do the substitution like:

zeros = [(s, 0) for s in r_tmp.free_symbols]
solution_as_list = r_tmp.subs(zeros)

Not sure what you are trying to do with the numpy array part though

Igor Morgado
@igormorgado
@valglad nice approach.
@valglad The solution_as_list, didn't returns a list per se, but a set with a tuple, as in: {(-0.916666666666667, 0.708333333333333, 0.375, -0.208333333333333, 0.0416666666666667, 0)} of type sympy.sets.sets.FiniteSet.
Igor Morgado
@igormorgado
@valglad Regarding to the numpy line. I'm very sticky to numpy, since I oftern work with it. Maybe I will keep everything inside sympy, until get the final solution.
V Gladkova
@valglad

I see, so you need to turn it into a list, flatten it and make everything a float. You could use a comprehension again like

solution = np.array([e for e in r_tmp]).astype(float)

It may or may not be slightly faster but it looks shorter

Ah, wait, that doesn't flatten it. So you'll have to do what you did or use SymPy's flatten anyway... Never mind then