Opened 6 years ago

Closed 6 years ago

#20595 closed enhancement (fixed)

Setting Besselexpand to true globally

Reported by: zonova Owned by:
Priority: minor Milestone: sage-7.3
Component: interfaces Keywords:
Cc: Merged in:
Authors: Saad Khalid Reviewers: Dima Pasechnik, Nils Bruin
Report Upstream: N/A Work issues:
Branch: 44696f1 (Commits, GitHub, GitLab) Commit: 44696f199937fbbf9f0529b2150e777942587c34
Dependencies: Stopgaps:

Status badges

Description

Check thread: https://groups.google.com/forum/#!topic/sage-support/PPsHBx6Z6Fc

I think it would be beneficial to Sage, in terms of its accessibility, if bessel functions were automatically reduced to trig functions. Part of my mentality is that those who know trig functions are not likely to know bessel functions, whereas though who do know about bessel functions are likely able to understand their equivalent trig form.

Emailing the Maxima development list here: https://sourceforge.net/p/maxima/mailman/maxima-discuss/thread/CAC05q1u%3D8gJRvBC6ucSRrHstsQqnse2pvV5Xs239qWdNyr1-Ow@mail.gmail.com/#msg34796315

It seems that it didn't cause any errors when tested, and is likely not to cause errors.

This is a simple change, however I was hoping to be able to do it myself so that I could gain an understanding of the entire process of adding to Sage.

Change History (16)

comment:1 Changed 6 years ago by zonova

  • Branch set to u/zonova/setting_besselexpand_to_true_globally

comment:2 Changed 6 years ago by git

  • Commit set to 6c1c6ac3d1d997fce5e7482f0d47ca0f2b816d9b

Branch pushed to git repo; I updated commit sha1. New commits:

6c1c6acChanged Besselexpand option to true

comment:3 Changed 6 years ago by zonova

  • Authors set to zonova
  • Branch u/zonova/setting_besselexpand_to_true_globally deleted
  • Commit 6c1c6ac3d1d997fce5e7482f0d47ca0f2b816d9b deleted
  • Status changed from new to needs_review

comment:4 Changed 6 years ago by zonova

  • Authors changed from zonova to Saad Khalid

comment:5 Changed 6 years ago by zonova

  • Branch set to u/zonova/setting_besselexpand_to_true_globally

comment:6 Changed 6 years ago by nbruin

  • Commit set to e3f0691f800e1b2fcd94990f9db77c770c136cc0

I don't think a string dumped in a file arbitrarily will get picked up as a doctest. Probably adding the test to sage.interfaces.maxima_lib.MaximaLib.sr_sum (in the same file) is the best solution.


New commits:

6c1c6acChanged Besselexpand option to true
e3f0691Added doctesting to besselexpand change.

comment:7 follow-up: Changed 6 years ago by git

  • Commit changed from e3f0691f800e1b2fcd94990f9db77c770c136cc0 to ed47f6a346a65df0ceb8db86f087b3cb307bdf9a

Branch pushed to git repo; I updated commit sha1. New commits:

ed47f6aChanging placement of doctest

comment:8 in reply to: ↑ 7 Changed 6 years ago by dimpase

Replying to git:

Branch pushed to git repo; I updated commit sha1. New commits:

ed47f6aChanging placement of doctest

you are not following the quite strict formatting rules for docs and doctests. In particular EXAMPLES must be in capitals, and everything in the EXAMPLES section should be indented appropriately. Look at how this is done elsewhere, e.g. in the same file:

def max_to_string(s):
    r"""
    Return the Maxima string corresponding to this ECL object.

    INPUT:

    - ``s`` - ECL object

    OUTPUT: string

    EXAMPLES::

        sage: from sage.interfaces.maxima_lib import maxima_lib, max_to_string
        sage: ecl = maxima_lib(cos(x)).ecl()
        sage: max_to_string(ecl)
        'cos(_SAGE_VAR_x)'
    """

probably your docs change should go into either one of functions, or into the top part of the file, which has somewhat different formatting rules. In particular it does not need EXAMPLES: keyword. So you could put your doc change just before the triple quote on line 52, as follows:

Changed besselexpand to true -- automatically simplify bessel functions to trig functions when appropriate when true. Examples:

For some infinite sums, a closed expression can be found. By default, "maxima" is used for that::

    sage: sum(((-1)^n)*((x)^(2*n+1))/factorial(2*n+1),n,0,oo)
    sin(x)

Maxima has some flags that affect how the result gets simplified(By default, besselexpand was set to false in Maxima)::

    sage:  maxima_calculus("besselexpand:false")
    false
    sage: sum(((-1)^n)*((x)^(2*n+1))/factorial(2*n+1),n,0,oo)
    1/2*sqrt(2)*sqrt(pi)*sqrt(x)*bessel_J(1/2, x)
    sage:  maxima_calculus("besselexpand:true")
    true

Note the double colons, and spacing I added.

Last edited 6 years ago by dimpase (previous) (diff)

comment:9 Changed 6 years ago by dimpase

  • Status changed from needs_review to needs_work
  • Work issues set to format docs properly

comment:10 Changed 6 years ago by git

  • Commit changed from ed47f6a346a65df0ceb8db86f087b3cb307bdf9a to 9df74c8c943416314ccf3ba67b05beb3cb7d387f

Branch pushed to git repo; I updated commit sha1. New commits:

9df74c8Fixed doctesting formatting again and put it after line 52

comment:11 Changed 6 years ago by kcrisman

The formatting is still not right...

comment:12 Changed 6 years ago by git

  • Commit changed from 9df74c8c943416314ccf3ba67b05beb3cb7d387f to 44696f199937fbbf9f0529b2150e777942587c34

Branch pushed to git repo; I updated commit sha1. New commits:

1e7f115editted some doctest formatting
44696f1Adding the variables before the sum in the doctest to make it execute properly.

comment:13 Changed 6 years ago by zonova

  • Status changed from needs_work to needs_review

comment:14 Changed 6 years ago by dimpase

  • Milestone changed from sage-7.2 to sage-7.3

comment:15 Changed 6 years ago by dimpase

  • Reviewers set to Dima Pasechnik, Nils Bruin
  • Status changed from needs_review to positive_review
  • Work issues format docs properly deleted

comment:16 Changed 6 years ago by vbraun

  • Branch changed from u/zonova/setting_besselexpand_to_true_globally to 44696f199937fbbf9f0529b2150e777942587c34
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.