Denis Akhiyarov | 29 Jan 08:02 2015
Picon

FYI: maple supports python code generation

Has anyone tried out Python (sympy, numpy. scipy) code generation from Maple?

http://www.maplesoft.com/products/maple/new_features/maple18/Code_Generation.aspx

 

import sympy
 

def cg0 (m): 
   r = 0 
   for i in range(1, m + 1): 
       r = r + sympy.prime(i) 
   return(r)

--
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 http://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/491d119b-e7f8-4c3f-a665-0d0da7872c8e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
gomireceiver | 29 Jan 05:43 2015
Picon

Simplifying Derivative(0,t)?

How do I get Derivative(0,t) simplified? In my code below, I used subs to substitute 0 for b(t) in a formula,
    a(t)*Derivative(b(t), t) + Derivative(a(t), t)

Then I got
a(t)*Derivative(0, t) + Derivative(a(t), t)
whereas the answer I want is: Derivative(a(t), t)

------------

from sympy import *
from sympy.physics.vector import *
from sympy.physics.mechanics import *

a=dynamicsymbols('a')
a_d=dynamicsymbols('a',1)
b=dynamicsymbols('b')
b_d=dynamicsymbols('b',1)

expr = a*b_d + a_d
print expr
expr2 = expr.subs(b, 0)
print expr2
print simplify(expr2)
------------

Thank you,
Iai

--
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 http://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/9670822f-1eb8-4946-96e1-4361de271b93%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Denis Akhiyarov | 28 Jan 23:28 2015
Picon

parse_expr

Can I use parse_expr to parse an expression such as "a1*x1**2+a2*x1+a3+a4*x1*x2+a5*x2**2" and inject the symbols into globals or locals namespace? 

Looks like auto_symbol is not doing this. So I have to manually inject each symbol using sympy.var() method.

exp0=parse_expr("a1*x1**2+a2*x1+a3+a4*x1*x2+a5*x2**2",transformations=(auto_number,auto_symbol))
exp0.subs(a1,10)


--------------------------------------------------------------------------- NameError Traceback (most recent call last) <ipython-input-4-19dc46bbe490> in <module>() ----> 1 exp0.subs(a1,10) NameError: name 'a1' is not defined


But after my hack:

for each_sym in exp0.atoms(sympy.Symbol):
    sympy.var(each_sym.__str__())


exp0.subs(a1,10)

2*x1 + a3 + a4*x1*x2 + a5*x2**2 + 10*x1**2

--
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 http://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/26d01fa4-15fd-45da-b043-9197410f0286%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Jason Moore | 28 Jan 17:41 2015
Picon

Fwd: Contributing to Source Code of SymPy

I've forwarded this email to the SymPy project.

You are welcome to contribute. See: https://github.com/sympy/sympy/wiki/introduction-to-contributing to get started.

Jason
moorepants.info
+01 530-601-9791

---------- Forwarded message ----------
From: Ankit Ranjan <ankitharrypotter-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Date: Wed, Jan 28, 2015 at 2:01 AM
Subject: Contributing to Source Code of SymPy
To: moorepants-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org


Hi,
I am Ankit Ranjan from PES University and I stumbled on to SymPy on
the GSoC website.

I really liked that a detailed symbolic mathematics library is being
made in python. The project has two of my favorite things - Maths and
Python. I have had Python as a subject of study in 5th sem.

The library has a huge application area as fields like theoretical
physics use maths extensively.

I am a third year student and I was wondering if there was any way I
could contribute to your project.

Regards,
Ankit Ranjan

--
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 http://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAP7f1AifogpvRn5wW_%3D7r90dj-mAqfmhW%2BHVWaOTPy8SNot0gQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Satyam Zode | 28 Jan 03:44 2015
Picon

Getting started with sympy

Hello everyone !

I am Satyam Zode , I am third year student and pursuing B.E degree major in Computer engineering from Pune Institute of Computer Technology , Pune (University of Pune ) India .
My area of interest is mainly mathematics . I have a good programming skills in python scripting, C and C++. I am open source enthusiast . I am willing to contribute for sympy organization. 
How can I get started in world of sympy ? Please suggest me any EasyToFix bugs. Certainly I will move to main issues which ain't EasyToFix once I will understand code base of sympy ;)

Thank you !
Satyam Zode

--
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 http://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/b6b51b7d-4791-4425-97e0-d171d6a73f0b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Sahil Shekhawat | 27 Jan 13:27 2015
Picon

Ipython notebook integration

Inspiration is this question and this PR (this is a kind of hack and should not be merged)
I want to implement ipython notebook integration in Sympy so that:
1) the user can easily use notebook's feature with Sympy
2) We can implement further parameters and animations in plotting specific to notebook.
3) Gamma can also use that API to export the result to Ipython notebook.
and who know maybe we want to replace the Gamma's result with notebook.
There can be future developments with this.

this can be used to implement and thus, should not be difficult. I can use and extend (if required) this and use nbconvert to convert it to notebook's format.
first question, should I do this? If yes then, how it should be implemented. I mean should it be like ``sympify``  so that any result can be open in notebook or should it be specific to plotting?
I would like to hear what you guys think?
Thanks

--
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 http://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/4ea19734-b3d1-4a97-ae3a-b9c3fc48c7aa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
almog yalin | 27 Jan 05:58 2015
Picon

Substitution into a derivative

I'm trying apply the following substitution a(x) = c * b(x) into a'(x)

a = sympy.Function('a')
b
= sympy.Function('b')
c
= sympy.Symbol('c')
x
= sympy.Symbol('x')
expression
= sympy.Derivative(a(x),x)
expression
= expression.subs(a(x),c*b(x))
print expression.simplify()

I was expecting to get
c*Derivative(b(x), x)
but got instead
Derivative(c*b(x), x)
Is there a way to move the coefficient c out of the derivative?

 

--
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 http://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/66c991ad-fc06-42f3-b46b-d096826df457%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Aaditya Nair | 25 Jan 22:45 2015
Picon

Beginner Here.

Hello,
I am a beginner to open source and want to contribute to SymPy. I am trying to understand the SymPy source.
Can anyone guide me on where to begin ?
Thanks.

--
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 http://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/6702c643-e529-4417-885e-25824b6e1c99%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Eric Tilley | 23 Jan 03:22 2015
Picon

Help modifying Sympy Gamma

Hello!

I am hosting a copy of Sympy Gamma on a Google App Engine server and using its JSON interface as a backend for my project. I am strong in C# and Python but no so great at web languages, so modifying the backend has been a challenge for me. I have made some modifications to Gamma to make fit my needs but have been stumped by one problem: I noticed that Gamma treats the ^ character as ** while Sympy Live treats is as an xor. I cannot seem to find a way to change this behavior in Gamma. Does anyone have any suggestions about how this could be implemented?

Thanks,
Eric

--
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 http://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/1a7c8d61-71f3-475d-bcc4-22d8bcdca2a6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Gaurav Dhingra | 23 Jan 02:56 2015
Picon

Summation of function

Hi all

I ran the following the following code

In[10]: simplify(summation((k), (k, 2, 4.7))) == simplify(summation((k), (k, 2, 4.4)))
Out[10]: False

I read the documentation of summation function, so according to it the summation includes all the integer values from start to end. But does not seem to follow it.

Is this a bug. ?

--
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 http://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/697cda0a-62db-411e-bf10-a9d601bbcb69%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Carsten Knoll | 21 Jan 22:49 2015
Picon
Picon

return types of solve?

I try to include sympy in teaching material.

When doing this, the focus is not on programming nor implementation
details. The CAS should be as "transparent" as possible. The CAS-using
code should read like the math done in a textbook.

I think sympy is very close to this. However, there are some annoying
obstacles to transparency.

One of it is the return behavior of solve. There are at least three
cases (if a solution can be found):

* a dict
* a list of tuples
* a list of dicts

for me it is hard to predict, when which case will occur. The behavior
can be influenced by keyword args but this would require additional
(off-topic) explanation to the students..

So, I am thinking in implementing my own wrapper for solve to overcome
this. However, I from my point of view it would be a lot cleaner if the
default return type (in the case of a unique solution) is always one
dict. Because then the solution can immediatly passed to subs(...).

Question: Is there any chance to change the solve behavior like that? (I
would try to work on it.)

See an example of what I mean (copied from an IP notebook):

In [1]:

import sympy as sp

print sp.__version__

0.7.5

In [2]:

x1, x2 = xx = sp.Matrix( sp.symbols("x1:3") )

z1, z2 = zz = sp.Matrix( sp.symbols("z1:3") )

In [3]:

q = sp.Matrix([x1, -x2 + x1*(1-x1**2)])

q

Out[3]:

Matrix([
[                  x1],
[x1*(-x1**2 + 1) - x2]])

Say z:=q(x). We want to calculate x=q^{−1}(z). We use 0=z−q(x) as
expression to solve.
In [4]:

sp.solve(q-zz, xx)  # returns a list (len=1) of tuples (len=2) of
expressions

Out[4]:

[(z1, -z1**3 + z1 - z2)]

In [5]:

# This is what I finally want to do:

# q_inv = xx.subs(x_sol)

# but this requires some overhead

sp.solve(q-zz, xx, dict=True)  # returns a list (len=1) of dicts

Out[5]:

[{x1: z1, x2: -z1**3 + z1 - z2}]

In [6]:

x_sol = sp.solve(q-zz, xx, dict=True)[0]

q_inv = xx.subs(x_sol)

q_inv  # this is the result I want (but with less 'magic' overhead)

Out[6]:

Matrix([
[              z1],
[-z1**3 + z1 - z2]])

In [7]:

# on the other hand, solve can behave like 'expected' (by me):

sp.solve(q-zz, zz)  # returns one dict (good)

Out[7]:

{z2: -x1**3 + x1 - x2, z1: x1}

Best regards,
Carsten.

--

-- 
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 http://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/54C01EE2.3040206%40gmx.de.
For more options, visit https://groups.google.com/d/optout.


Gmane