singlets | 24 Jul 22:44 2016

Can init_printing() be forced to print mathjax/latex in a "dumb" console?

(Probably a newbie question here, but not finding it in ggroup or docs)

Can I convince init_printing() to give the mathjax/latex representation of an expression in an IPython terminal session without using latex(expr)?

For example (Anaconda/python3, linux, sympy 1.0 in an xterm or emacs console):

from sympy import *
init_printing(use_latex='mathjax')
var('x')
expr = x**2
expr

desired output:
x^{2}

I have tried various options to init_printing() like use_latex=True, use_latex='mathjax', 'matplotlib', etc., but sympy falls back to simple forms (str, pretty-printers) unless in a qtconsole or notebook. I must be misunderstanding how init_printing() works (or maybe there's another approach I should be using?).

Motivation: I'm using org mode and it's support for mathjax/latex to generate content that can be migrated directly into Jupyter notebooks. I'm hoping to avoid translating latex(expr) into expr everywhere.

Thanks,
Steve

--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To post to this group, send email to sympy-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/9f4b3633-77b2-41b7-826b-64c09355be70%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
kassbohm | 21 Jul 10:40 2016
Picon
Gravatar

[sympy] Lagrange’s Method in Physics/Mechanics: No stiffness matrix - but mass matrix?

from sympy.physics.mechanics import *

LM = LagrangesMethod(L, [q1, q2])
LM.form_lagranges_equations()
LM.mass_matrix

gives the *mass matrix* - which contains some coefficients.

Why is there no:

LM.stiffness_matrix

giving the *stiffness matrix* - containing some other coefficients?

Regards,
Sven

--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To post to this group, send email to sympy-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/27e9f601-a17c-447c-8c2a-a043c2d9ff82%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
kassbohm | 21 Jul 10:08 2016
Picon
Gravatar

[sympy] Lagrange’s Method in Physics/Mechanics: Stiffness Matrix

from sympy.physics.mechanics import *

provides:
LM = LagrangesMethod(L, [q1, q2])

and:
LM.mass_matrix

i.e. a matrix of some coefficients...

Why is there no:
LM.stiffness_matrix

i.e. a matrix of some other coefficients...?

Regards,
Sven 

--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To post to this group, send email to sympy-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/1a0ccccf-bc06-4644-9000-1706642117da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Francesco Bonazzi | 19 Jul 10:52 2016
Picon

Function and Indexed objects behavior with .has( )

The SymPy master branch has been recently updated to handle derivatives of Indexed objects. They have the peculiarity of generating a Kronecker delta:

In [8]: A[i].diff(A[j])
Out[8]:
δ  
 i
,j

In [9]: /type _
Out[9]: KroneckerDelta


The solution involved some hacks in the differentiation routine, especially to prevent the .has( ) method from returning False, thus implying a null result to the derivative (if the derivation variable is not present, derivative is zero).

In general, .has( ) is used quite often. A recent fix to the series expansion does not produce a series expansion with Kronecker delta because of .has( ):


In [6]: sin(A[i]).series(A[i])
Out[6]:
           
3       5          
       
A[i]    A[i]        6
A[i] - ───── + ───── + OA[i]
         
6      120            

In [7]: sin(A[i]).series(A[j])
Out[7]: sin(A[i])

I was wondering, is it sound to overload .has( ) in order to return A[i].has(A[j]) ===> True ?

Concerning functions, a similar problem could arise:

In [15]: f(x).diff(f(x))
Out[15]: 1

In [17]: f(x).diff(f(y))
Out[17]: 0


I think that output 17 should be a Dirac delta function: DiracDelta(x - y). What do you think?

In [18]: f(x).has(f(x))
Out[18]: True

In [19]: f(x).has(f(y))
Out[19]: False

Here also, output 19 could be changed to True, as f(x) derived by f(y) would now be nonzero.

What do you think? Shall we proceed this way?

--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To post to this group, send email to sympy-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/b05ebb77-ccc9-4405-96e1-c42bcafab531%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Aaron Meurer | 17 Jul 18:45 2016
Picon
Gravatar

SymPy codegen SI2: SSI proposal

We are looking at applying for a SI2: SSI proposal to improve the code generation in SymPy. Here is a link to the proposal information: https://www.nsf.gov/pubs/2016/nsf16532/nsf16532.htm. From the website: “SI2: SSI awards target larger, interdisciplinary teams organized around the development and application of common software infrastructure aimed at solving common research problems faced by NSF researchers in one or more areas of science and engineering. SSI awards will result in a sustainable community software framework serving a diverse community or communities.”

The goal of this collaboration is to dramatically expand the code generation capabilities of SymPy. It aims to be multidisciplinary and multi-institution. We believe this proposal would be strengthened by a diverse set of applications. 

If you are interested in participating in this, please let us know. Also, if you know any other potentially interested parties, feel free to forward this to them. The proposal deadline is September 19, 2016.

We had a meeting with several people here at SciPy, and we would like to have a

Let's schedule a meeting to start discussing the SI2 proposal in more detail. Is everyone, particularly those who are interested in being on the proposal, free to meet some time on Wednesday (July 20) via Google hangouts?

If someone you know might be interested who isn't on the SymPy mailing list, feel free to forward this to them. 

Aaron Meurer

--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To post to this group, send email to sympy-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6%2BDp_34WkdOPHcJ3zyf44wQHvZgoy5n4jhcMseJKnZK8A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Massimo Biber | 14 Jul 16:09 2016
Picon

Problem with Matrix normalized() and Matrix norm()

>>> from sympy import *
>>> v=symbols('v:3',real=True);v
(v0, v1, v2)
>>> V=Matrix(v);V
Matrix([
[v0],
[v1],
[v2]])
>>> U=V.normalized()
>>> U
Matrix([
[v0/sqrt(v0**2 + v1**2 + v2**2)],
[v1/sqrt(v0**2 + v1**2 + v2**2)],
[v2/sqrt(v0**2 + v1**2 + v2**2)]])
>>> U.norm()
sqrt(v0**2/(-v0**2 - v1**2 - v2**2) + v1**2/(-v0**2 - v1**2 - v2**2) + v2**2/(-v0**2 - v1**2 - v2**2))
>>> _.simplify()
I

Why is U.norm() not equal 1?

--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To post to this group, send email to sympy-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/e2f0047c-e2f8-4f41-8b2f-8f00c01cdcb7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Massimo Biber | 14 Jul 15:59 2016
Picon

Matrix normalized, Matrix norm

>>> from sympy import *
>>> v=symbols('v:3',real=True);v
(v0, v1, v2)
>>> V=Matrix(v);V
Matrix([
[v0],
[v1],
[v2]])
>>> U=V.normalized()
>>> U
Matrix([
[v0/sqrt(v0**2 + v1**2 + v2**2)],
[v1/sqrt(v0**2 + v1**2 + v2**2)],
[v2/sqrt(v0**2 + v1**2 + v2**2)]])
>>> U.norm()
sqrt(v0**2/(-v0**2 - v1**2 - v2**2) + v1**2/(-v0**2 - v1**2 - v2**2) + v2**2/(-v0**2 - v1**2 - v2**2))
>>> _.simplify()
I
>>> 

Why is U.norm() NOT equal 1?

--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To post to this group, send email to sympy-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/1613d8ad-1684-4138-a5d1-f50a45813bee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Aaron Meurer | 13 Jul 18:00 2016
Picon
Gravatar

Google Scholar alerts for SymPy

If anyone is interested in seeing some of the broad ways that people use SymPy, at least in academic settings, I would recommend setting up a Google Scholar alert for SymPy https://scholar.google.com/scholar_alerts?view_op=list_alerts&hl=en.

Here is a nice example, which is a pure math paper which is relatively simple (anyone should be able to follow it), which uses SymPy to do a calculation in a proof near the end. https://arxiv.org/abs/1606.05398

Aaron Meurer

--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To post to this group, send email to sympy-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6KuU4q1-GLPZZzZyViJbf%3DeU87Q6SYmLsmZBPqY3W_Sog%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Ondřej Čertík | 12 Jul 19:01 2016
Picon
Gravatar

Move sympy.org to https

Hi,

So GitHub I think still doesn't allow to host https on custom domains,
like we need for sympy.org. However, I think GitLab made it recently
very easy to use https (for free!) on custom domains, it's described
in detail here:

https://about.gitlab.com/2016/06/24/secure-gitlab-pages-with-startssl/

So we should move our pages to https://sympy.org/ and redirect
http://sympy.org there.

Ondrej

--

-- 
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscribe@...
To post to this group, send email to sympy@...
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CADDwiVCH3vGCOhBQQyNf2CCS_1hmSyNQgcPWKibryPc4WSa2hA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Kenneth Frankel | 9 Jul 00:46 2016

problem in simply with matrix value and multiplication

I downloaded python and simply (etc) from anaconda, and installed anaconda2 and anaconda3.
I upgraded to the latest simply (1.0) and have this problem

When I run

import sympy

from sympy import *

sympy.__version__


x=Symbol('x')

y=Symbol('y')

M=IndexedBase('M')


integrate(cos(M[0] + x*y),x)

integrate(cos(M[0] + x),x)

integrate(cos(M[0] * x),x)


They all work except integrate(cos(M[0] * x),x) throws an error (see output below).

All I can find in the documentation is that there can be 'problems'.

Any idea if I am missing something or is there a bug in simply?

In the meantime my problem is so complex, I can only use variables 2 at a time,

so I can hardcode a fix in my formulas.


Thanks for any advice.

Regards,

Ken Frankel


output:

(same in python 3.5.1 and 2.7.11


python

Python 2.7.11 |Anaconda 4.0.0 (32-bit)| (default, Dec  6 2015, 18:08:45) 

[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2

Type "help", "copyright", "credits" or "license" for more information.

Anaconda is brought to you by Continuum Analytics.

Please check out: http://continuum.io/thanks and https://anaconda.org

>>> import sympy

>>> from sympy import *

>>> sympy.__version__

'1.0'

>>> 

>>> x=Symbol('x')

>>> y=Symbol('y')

>>> M=IndexedBase('M')

>>> 

>>> integrate(cos(M[0] + x*y),x)

Piecewise((x*cos(M[0]), Eq(y, 0)), (sin(x*y + M[0])/y, True))


>>> integrate(cos(M[0] + x),x)

sin(x + M[0])


>>> integrate(cos(M[0] * x),x)

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "/home/Users/frankel/anaconda2/lib/python2.7/site-packages/sympy/integrals/integrals.py", line 1280, in integrate

    risch=risch, manual=manual)

  File "/home/Users/frankel/anaconda2/lib/python2.7/site-packages/sympy/integrals/integrals.py", line 486, in doit

    conds=conds)

  File "/home/Users/frankel/anaconda2/lib/python2.7/site-packages/sympy/integrals/integrals.py", line 860, in _eval_integral

    h = trigintegrate(g, x, conds=conds)

  File "/home/Users/frankel/anaconda2/lib/python2.7/site-packages/sympy/integrals/trigonometry.py", line 100, in trigintegrate

    return Piecewise((zz, Eq(a, 0)), (fx / a, True))

  File "/home/Users/frankel/anaconda2/lib/python2.7/site-packages/sympy/functions/elementary/piecewise.py", line 110, in __new__

    r = cls.eval(*newargs)

  File "/home/Users/frankel/anaconda2/lib/python2.7/site-packages/sympy/functions/elementary/piecewise.py", line 146, in eval

    cond_eval = cls.__eval_cond(cond)

  File "/home/Users/frankel/anaconda2/lib/python2.7/site-packages/sympy/functions/elementary/piecewise.py", line 507, in __eval_cond

    if checksol(cond, {}, minimal=True):

  File "/home/Users/frankel/anaconda2/lib/python2.7/site-packages/sympy/solvers/solvers.py", line 227, in checksol

    if not val.is_constant(*list(sol.keys()), simplify=not minimal):

  File "/home/Users/frankel/anaconda2/lib/python2.7/site-packages/sympy/core/expr.py", line 535, in is_constant

    simultaneous=True)

  File "/home/Users/frankel/anaconda2/lib/python2.7/site-packages/sympy/core/basic.py", line 893, in subs

    rv = rv._subs(old, d*m, **kwargs)

  File "/home/Users/frankel/anaconda2/lib/python2.7/site-packages/sympy/core/basic.py", line 1016, in _subs

    rv = fallback(self, old, new)

  File "/home/Users/frankel/anaconda2/lib/python2.7/site-packages/sympy/core/basic.py", line 988, in fallback

    arg = arg._subs(old, new, **hints)

  File "/home/Users/frankel/anaconda2/lib/python2.7/site-packages/sympy/core/basic.py", line 1016, in _subs

    rv = fallback(self, old, new)

  File "/home/Users/frankel/anaconda2/lib/python2.7/site-packages/sympy/core/basic.py", line 993, in fallback

    rv = self.func(*args)

  File "/home/Users/frankel/anaconda2/lib/python2.7/site-packages/sympy/tensor/indexed.py", line 334, in __new__

    raise TypeError("Base label should be a string or Symbol.")

TypeError: Base label should be a string or Symbol.

--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To post to this group, send email to sympy-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/9fdd6809-e4da-4ff1-a3be-d206f02cb169%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Björn Dahlgren | 8 Jul 17:45 2016
Picon
Gravatar

Optimize ordering of arguments in e.g. Add for LaTeX printing

Hi,

The argument ordering of e.g. Add is lexiographical, and the printing follows the argument order:

>>> (y-x)*(z-y)
(-x + y)⋅(-y + z)

is there already functionality to have the printing system reorder arguments to minimize number of signs printed?
(I am generating LaTeX expressions and I'd rather avoid editing them by hand).

Best regards,
Björn

--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To post to this group, send email to sympy-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/a4d0ec78-c065-4894-9582-a5c42d8dff37%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gmane