Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
• Create your own community
Activity
• 13:06
MiguelGuthridge opened #22142
• 09:53
oscargus commented #14933
• 09:50
oscargus commented #14933
• 09:50
oscargus commented #14933
• 09:46
oscargus labeled #22134
• 09:44
oscargus commented #22139
• 09:43
oscargus labeled #22139
• 09:34
oscargus commented #14933
• 08:36
github-actions[bot] commented #22140
• 08:19
Upabjojr commented #21494
• 07:58
sidhu1012 commented #22141
• 07:58
sidhu1012 labeled #22141
• 07:58
sidhu1012 opened #22141
• 07:57
Upabjojr commented on e9b3849
• 07:08
smichr commented #21986
• 07:08
sympy-bot commented #22140
• 07:08
smichr opened #22140
• 07:05

smichr on nc_coeff

• 07:05
smichr closed #22137
• 07:01
github-actions[bot] commented #21903
Vishesh Mangla
@Teut2711
abs gives whats expected but sm.arg doesn't , what else can be done to get the argument?
some function which does this is required
Vishesh Mangla
@Teut2711
I m trying to make a table like this, where each many cells of the matrix should contain unevaluated determinants
gives
Vishesh Mangla
@Teut2711
row += [sm.Mul(sm.Matrix([
[row1[0], row2[k] ],
[row2[0], row2[k]]
]), -1/row2[0], evaluate=False)]
so I did get a Matrix in matrix as expected but the evaluate=False didnt work. What is that am I doing wrong?
Aaron Meurer
@asmeurer
you probably need to use MatMul
Gaurav Dhingra
@gxyd

Hey guys, I'm trying to use parse_latex function as below:

In [1]: from sympy.parsing.latex import parse_latex

In [2]: r = "5^0 - 4^0"

In [3]: parse_latex(r)
ANTLR runtime and generated code versions disagree: 4.9.2!=4.7.2
ANTLR runtime and generated code versions disagree: 4.9.2!=4.7.2
Out[3]: -1 + 5**0

Is there anyway, I can stop parse_latex to render it as 5^ 0 - 4^0 and now evaluate 4^0 as 1?

Vishesh Mangla
@Teut2711

you probably need to use MatMul

yes , that was it. thanks

Kalevi Suominen
@jksuom
@gxyd On this line, we have lh = 5**0 and rh = 4**0 but -1 * rh will be evaluated to -1. If you want to preserve rh, it looks like -1 * rh should be replaced by Mul(-1, rh, evaluate=False).
3 replies
Madhava Jay
@madhavajay
Hi, does anyone know if its possible to do the floating point evaluation with fixed-precision / Fixed-point integer-valued calculations?
1 reply
Madhava Jay
@madhavajay

From what I can see Rational inherits from Number which defines evalf as :

    def _eval_evalf(self, prec):
return Float._new(self._as_mpf_val(prec), prec)

So I assume that all the calculations are resolved using Floats?

famubu
@famubu:matrix.org
[m]
Does sympy support python2? Which is the earliest version of python3 that is supported? Would 3.5 be okay?
Kalevi Suominen
@jksuom
@famubu:matrix.org The oldest supported version is 3.6 though 3.5 may often work.
1 reply
Vishesh Mangla
@Teut2711
also how to prevent the reordering of symbols while multiplication
Naveen Sai
@naveensaigit
@XtremeGood Try UnevaluatedExpr(mdot)*UnevaluatedExpr(Cp)*UnevaluatedExpr(delta)
Kunal Mahatha
@kunal-mahatha
Hello every I am new to open source and want to contribute to sympy. I saw the good first issue but those are too old like 2017-2018. Any beginner friendly issue for me
Abdullah Tahir
@MAT919
Hello everyone I really want to contribute sympy. But I’m new to open source if anyone can help me. I will be grateful. Please contact me at abdullahtahir919@protonmail.com
Fabio Luporini
@FabioLuporini_twitter
HI all! Given that sympy uses caches to speed up symbolic manipulation, I'd guess it's not thread safe (ie multiple python threads attempting to create symbols concurrently). False or true?
2 replies
Matthew Roos
@mattroos
I'm brand new to sympy and to computer algebra systems. I'd like to create a function that can take in an expression and return an expression in which any symbols raised to a power (integer, and >1) are placed by 1. For example, x**2 + x*y**3 becomes x + x*y. Any pointers as to what I should review/read in the repo or the sympy.org website, to get me started, would be much appreciated!
Naveen Sai
@naveensaigit
@mattroos This may not be the most efficient way to do it, but it works
In [95]: e = x**(S(3)/2) + x**2*y**3 + x + 1/y
...: e
Out[95]:
3/2    2  3       1
x    + x ⋅y  + x + ─
y

In [96]: powers = e.atoms(Pow)
...: powers
Out[96]:
⎧ 3/2   2  1   3⎫
⎨x   , x , ─, y ⎬
⎩          y    ⎭

In [97]: int_powers = list(filter(lambda x: x.exp.is_Integer and x.exp > 1, powers))
...: int_powers
Out[97]:
⎡ 3   2⎤
⎣y , x ⎦

In [98]: {k:v for k, v in zip(int_powers, list(map(lambda x: x.base, int_powers)))}
Out[98]:
⎧ 2      3   ⎫
⎨x : x, y : y⎬
⎩            ⎭

In [99]: e.subs({k:v for k, v in zip(int_powers, list(map(lambda x: x.base, int_powers)))})
Out[99]:
3/2             1
x    + x⋅y + x + ─
y
Matthew Roos
@mattroos
Thanks, @naveensaigit! I'm learning a lot about sympy from that single example!
Gaurav Dhingra
@gxyd
Hi @asmeurer , any expected date by when can we see the SymPy 1.9 coming out?
Fabio Luporini
@FabioLuporini_twitter
Hi everyone! How can I enforce precedence on the Mod in a*(b%3) where a and b are plain Symbol ? SymPy will evaluate it to a*Mod(b, 3), while I'd want to keep the precedence explicit (so that ultimately generation of lower level code honours this user-enforced precedence)
Oscar Benjamin
@oscarbenjamin
You can enforce precedence with brackets as you showed.
13 replies
mostlyaman
@mostlyaman
Hi everyone! Can anyone verify that my release notes for sympy/sympy#21553 are acceptable so that I can add them manually to the wiki. The PR has been closed now. Thanks!
Aaron Meurer
@asmeurer
@mostlyaman yes they look good
mostlyaman
@mostlyaman
@asmeurer Thanks! Added them to the wiki.
Shamitha
@ShamithaReddy
Hi everyone, can anyone say why this isn't working. p=lambda x: x*2, Range(n)
1 reply
p(3), this is giving error-- Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: 'tuple' object is not callable
I'm new to sympy, can anyone help
sharath sr
@Sharath-a26
Hello guys, i'm interested to work on this project, Can someone guide me?
ASUTOSH GHANTO
@asutoshgha
how to actually contribute to this repository?
what additional features we can add?
Akhil (#stayhome #staysafe )
@AkhilBollu_twitter
Hello everyone
Is anyone there??
Shamitha
@ShamithaReddy
YUP @AkhilBollu_twitter
hi
ASUTOSH GHANTO
@asutoshgha
please help
I want to improve
Miguel Guthridge
@MiguelGuthridge
Is there a way for me to include sympy as a module in another project so that I can import it inside an interpreter where pip installing modules isn't accessible?
2 replies
I'm trying to make an extension to a search program that uses python so that when you type eq [some equation] it'll solve it
But since I've never included a package without having it pip installed, I'm not entirely sure where to start haha
shashankks0987
@shashankks0987
My test is returning this as the expected output Complement(Integers, ConditionSet(n, Eq((n - 1)*(n + 1), 0), Integers)). I need to convert this to 'sympy' form. Need help
oponkork
@oponkork

Why does the following latex code of the function varies from the symbol?

import sympy as sp
r = sp.symbols("r")
print(sp.latex(sp.symbols("\delta\ u_t")))
print(sp.latex(sp.Function("\delta\ u_t")(r)))

gives

\delta u_{t}
\delta\ u_{t}{\left(r \right)}

Notice that the space right after \delta is escaped for the function, but not for the symbol.