Python Forum
Thread Rating:
  • 2 Vote(s) - 3.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sympy Integration
#1
I couldn't find a Sympy forum, so I figured I'd post it here.

Please explain this to me:
>>> integrate(sin(x**2),x)
                      ⎛  ___  ⎞       
    ___   ___         ⎜╲╱ 2 ⋅x⎟       
3⋅╲╱ 2 ⋅╲╱ π ⋅fresnels⎜───────⎟⋅Γ(3/4)
                      ⎜   ___ ⎟       
                      ⎝ ╲╱ π  ⎠       
──────────────────────────────────────
               8⋅Γ(7/4)               
>>> integrate(sin(t**2),(t,0,x))
                      ⎛  ___  ⎞       
    ___   ___         ⎜╲╱ 2 ⋅x⎟       
3⋅╲╱ 2 ⋅╲╱ π ⋅fresnels⎜───────⎟⋅Γ(3/4)
                      ⎜   ___ ⎟       
                      ⎝ ╲╱ π  ⎠       
──────────────────────────────────────
               8⋅Γ(7/4)               
Shouldn't the integral of sin(x^2) just be fresnels(x)? What's with all that other stuff?
Reply
#2
Could you provide enough code to reproduce what you have here? That's not what I see
>>> import sympy
>>> x = sympy.Symbol('x')
>>> sympy.integrate(sympy.sin(x**2),x)
Integral(sin(x**2), x)
Reply
#3
I did the same thing you did, with the exception of "init_printing()". Here, I started from scratch again:
Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from sympy import *
>>> x = symbols("x")
>>> integrate(sin(x**2),x)
3*sqrt(2)*sqrt(pi)*fresnels(sqrt(2)*x/sqrt(pi))*gamma(3/4)/(8*gamma(7/4))
My OS is Linux Mint 18, and I installed python and sympy from the terminal with "sudo apt-get install python python-sympy". I don't know how to check Sympy's version. I have Sympy 0.7.6.1-1

Same thing happens in Python 3:
Python 3.5.2 (default, Nov 17 2016, 17:05:23) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from sympy import *
>>> x = symbols("x")
>>> integrate(sin(x**2),x)
3*sqrt(2)*sqrt(pi)*fresnels(sqrt(2)*x/sqrt(pi))*gamma(3/4)/(8*gamma(7/4))
Reply
#4
Ok, I was originally using a Raspberry Pi with Python 2.7.3 and Sympy 0.7.1.rc1, but just tried on a Linux Mint machine running Python 2.7.6 and Sympy 0.7.4.1. On the Mint machine, I got the same wonky result that you did.

It might be a bug. There are similar bugs filed on Github right now, and have been open for a while. My first suggestion is to try an older version of Sympy, and my second suggestion is to follow up with them on Github.
Reply
#5
All right, I added to the Github thread. Hopefully it gets resolved! =]
Reply
#6
Best of luck!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  solve ODE with sympy Sergey_Novak 2 902 Dec-02-2023, 12:33 PM
Last Post: Sergey_Novak
  Active Directory integration dady 2 463 Oct-13-2023, 04:02 AM
Last Post: deanhystad
  Help with Integration Pandas excel - Python Gegemendes 5 1,725 Jun-05-2022, 09:46 PM
Last Post: Gegemendes
  I need assistance with getting sympy to work alex_0 1 1,477 Apr-05-2021, 09:15 PM
Last Post: snippsat
Photo Integration of apache spark and Kafka on eclipse pyspark aupres 1 3,701 Feb-27-2021, 08:38 AM
Last Post: Serafim
  Tableau Time Series Prediction using Python Integration tobimarsh43 0 1,888 Jul-24-2020, 10:38 AM
Last Post: tobimarsh43
  R-PYTHON INTEGRATION RELATED PROBLEM arnab93 0 1,418 Jun-05-2020, 02:07 PM
Last Post: arnab93
  STATA/Python Integration jprender 0 1,804 May-03-2020, 09:38 PM
Last Post: jprender
  Sympy error "object is not callable" Cupcake 0 4,811 Feb-08-2020, 02:22 AM
Last Post: Cupcake
  Integration of a complex function having singularities using quad amjad26 0 5,582 May-17-2019, 09:16 PM
Last Post: amjad26

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020