Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor docs changes for functions like minimize() which have same handle in Python and SAGE #14493

Open
sagetrac-GaryMak mannequin opened this issue Apr 26, 2013 · 3 comments

Comments

@sagetrac-GaryMak
Copy link
Mannequin

sagetrac-GaryMak mannequin commented Apr 26, 2013

As a very inexperienced person in this field I found it very difficult from the existing docs to understand the difference in syntax between the python and sage functions "minimize" - and I imagine this applies to other function handles as well: though I will need some guidance as to which function specs I need to amend.


See this sage-support discussion:

vars = var('x y')
def gg(x,y): return sin(x) + cos(y)
minimize(gg,[0,0])

gives a TypeError, while

vars = var('x y')
gg = sin(x) + cos(y)
minimize(gg,[0,0])

doesn't, but

sage: def gg(x): return sin(x[0]) + cos(x[1]) 
sage: minimize(gg,[0,0]) 
Optimization terminated successfully. 
          Current function value: -2.000000 
          Iterations: 72 
          Function evaluations: 139 
(-1.5707636272, 3.14159570731) 

does.

The relevant possibly confusing doc is here.

CC: @mforets @dimpase

Component: documentation

Issue created by migration from https://trac.sagemath.org/ticket/14493

@sagetrac-GaryMak sagetrac-GaryMak mannequin added this to the sage-5.11 milestone Apr 26, 2013
@jdemeyer jdemeyer modified the milestones: sage-5.11, sage-5.12 Aug 13, 2013
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@kcrisman

This comment has been minimized.

@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@mforets
Copy link
Mannequin

mforets mannequin commented May 27, 2017

comment:7

assuming that this ticket is for documentation only (not for the feature itself), i find that the docstring is currently well and clear in this respect.

this is because it says:

    INPUT:

    - ``func`` -- Either a symbolic function or a Python function whose
      argument is a tuple with `n` components

for this reason i suggest to either close this ticket, or to add an extra note:

- If you use a Python function, the argument must be a tuple with `n` components, e.g. 
``def func(x): return sin(x[0]) + cos(x[1])`` instead of ``def func(x,y): return sin(x) + cos(y)``.

@mforets mforets mannequin modified the milestones: sage-6.4, sage-8.0 May 27, 2017
@kcrisman
Copy link
Member

comment:8

The latter seems good, because I wouldn't have figured out that syntax from no example.

@mkoeppe mkoeppe removed this from the sage-8.0 milestone Dec 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants