bugGNU Octave - Bugs: bug #33935, demo function humps is not defined

 
 

bug #33935: demo function humps is not defined

Submitted by:  None
Submitted on:  Wed 03 Aug 2011 06:26:56 AM UTC  
 
Category: Octave FunctionSeverity: 1 - Wish
Priority: 1 - LaterItem Group: Matlab Compatibility
Status: FixedAssigned to: None
Originator Name: Alex FengOriginator Email: -unavailable-
Open/Closed: ClosedRelease: dev
Operating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Fri 11 Aug 2017 04:48:31 PM UTC, comment #10:

I refreshed the patch for the current development sources, made a few additional minor fixes, and pushed the changeset here:

http://hg.savannah.gnu.org/hgweb/octave/rev/86a49caa5100

Thanks!

John W. Eaton <jwe>
Project Administrator
Wed 08 Feb 2017 02:09:31 PM UTC, comment #9:

updated patch. included @tex and @ifnotex versions of equation in doc section.

(file #39703)

Nicholas Jankowski <nrjank>
Sun 05 Feb 2017 03:43:16 AM UTC, comment #8:

added a couple extra tests and a demo. no argument is just supposed to return the function value for compatibility, so didn't make it plot. but the demo pops up a plot and is mentioned in the help.

Looking at matlab, humps is only mentioned when used as an example for fzero and fminsearch, etc.

So I dropped it into the optimization folder, and added it to the manual after those functions with a mention that it is a useful test function.

changeset added including mfile, module.mk, doc change and added function name to news. Also attached the updated m file.

(file #39665, file #39666)

Nicholas Jankowski <nrjank>
Tue 31 Jan 2017 12:06:23 PM UTC, comment #7:

In Octave, we don't error on nargout being too large, we just let it go and then you get a generic warning about undefined outputs.

If you call error before print_usage, the print_usage function will never be executed.

Instead of checking nargin, you could use a default input value.

The whole function could then be

Also, @var{x} will capitalize its argument when generating Info output, but will not when generating TeX output (it uses a slanted font instead), so you should write @var{x}, not @var{X}.

Could someone make those changes and also create a proper changeset that adds this file to some directory (which one? Octave doesn't currently have a demos directory), updates the corresponding module.mk file, and adds the function to the manual?

I suppose it could be included along with sombrero and peaks. Maybe make it plot the function if nargout is 0?

And, for completeness, maybe add a test or two just so it doesn't add to the count of functions without tests?

Thanks.

John W. Eaton <jwe>
Project Administrator
Fri 27 Jan 2017 10:32:11 AM UTC, comment #6:

patch reviewed.

Maintainers: please review and push this patch.

Avinoam Kalma <avinoam>
Project Member
Sat 19 Nov 2016 03:22:58 PM UTC, comment #5:

The Matlab demo functioin "humps.m" is still missing in Octave 4.2.0.

An Octave version of this m-file is attached to comment #4.

Hartmut <hardy>
Sun 13 Dec 2015 09:52:06 PM UTC, comment #4:

tweaked the help text to remove the function class type from the docstring as per recent Octave Code Sprint activity.

(file #35735)

Nicholas Jankowski <nrjank>
Sun 13 Dec 2015 02:49:43 AM UTC, comment #3:

attached with added help and tests. Think this version is complete. only thing it's missing are any 'see also's. it doesn't seem to relate to anything. matlab help only had it 'see also' some demo functions that used it. can generate a patch if someone tells me where it should go. not sure what part of the docs it would fit into. there is a section on demo plots like sombrero and peaks, but this function doesn't plot anything.

(file #35725)

Nicholas Jankowski <nrjank>
Sat 12 Dec 2015 10:09:19 PM UTC, comment #2:

saw this looking through old 'need infos'. (website sorts by type with oldest first)

peeking at humps, it looks like a rational function which I've been playing with recently. Used rational polynomial fit tool along with humps([-10:.01:10]). Got a R2=1 fit with m=n=4. normalized coefficients with Maxima and got the following:

plot seems to overlap perfectly, too.

I remember 'way' back when using humps as a good test function with close local maxima for peak finding, thought it may be useful to have. Since it popped out so easily, thought I'd code it up.

1st cut m-file attached. not quite ready for a patch/submission yet. i think I got all the use cases right. need help/usage and tests.

chalk it up to me procrastinating on other work by taking care of those 'high priority' needs. ;)

(file #35722)

Nicholas Jankowski <nrjank>
Mon 08 Aug 2011 04:26:58 PM UTC, comment #1:

It looks to me like the humps function is a demo function in Matlab, not a part of the core functions. Do you really expect that Octave provides all the Matlab demo functions? To me, this has a really low priority. But if someone provides an independent implementation, then I guess it could be included in Octave.

John W. Eaton <jwe>
Project Administrator
Wed 03 Aug 2011 06:26:56 AM UTC, original submission:

The function humps is a function provided by MatLab, but it is not defined for Octave. Here is the info provided by Matlab: http://www.mathworks.com/products/matlab/demos.html?file=/products/demos/shipping/matlab/funfuns.html

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #39703:  add_humps_v2.diff added by nrjank (5KiB - application/octet-stream - updated patch, adds tex version of formula to documentation)
file #39666:  humps.m added by nrjank (3KiB - application/octet-stream - 'final' versions)
file #39665:  add_humps.diff added by nrjank (5KiB - application/octet-stream - 'final' versions)
file #35735:  humps.m added by nrjank (3KiB - application/octet-stream - updated as per comment 4)
file #35725:  humps.m added by nrjank (3KiB - text/x-objcsrc - 'complete' implementation)
file #35722:  humps.m added by nrjank (560B - text/x-objcsrc - 1st implementation of humps.m)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by avinoam (Updated the item)
  • -unavailable- added by hardy (Posted a comment)
  • -unavailable- added by nrjank (Updated the item)
  • -unavailable- added by mtmiller (Updated the item)
  • -unavailable- added by jwe (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 18 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 11 Aug 2017 04:48:31 PM UTCjweStatusPatch Reviewed=>Fixed
      Open/ClosedOpen=>Closed
    Wed 08 Feb 2017 02:09:31 PM UTCnrjankAttached File-=>Added add_humps_v2.diff, #39703
    Sun 05 Feb 2017 03:43:16 AM UTCnrjankAttached File-=>Added add_humps.diff, #39665
      Attached File-=>Added humps.m, #39666
    Fri 27 Jan 2017 10:32:11 AM UTCavinoamStatusPatch Submitted=>Patch Reviewed
    Sat 19 Nov 2016 07:57:22 PM UTCavinoamStatusNeed Info=>Patch Submitted
    Sun 13 Dec 2015 09:52:06 PM UTCnrjankAttached File-=>Added humps.m, #35735
    Sun 13 Dec 2015 02:49:43 AM UTCnrjankAttached File-=>Added humps.m, #35725
    Sat 12 Dec 2015 10:09:19 PM UTCnrjankAttached File-=>Added humps.m, #35722
    Sun 29 Sep 2013 11:52:58 PM UTCmtmillerCategoryLibraries=>Octave Function
      Severity3 - Normal=>1 - Wish
      StatusNone=>Need Info
      Release3.2.4=>dev
      Operating SystemMicrosoft Windows=>Any
      Summarythe function humps is not defined=>demo function humps is not defined
    Mon 08 Aug 2011 04:26:58 PM UTCjwePriority5 - Normal=>1 - Later
      Item GroupNone=>Matlab Compatibility

    Back to the top


    Powered by Savane 3.1-cleanup1