bugGNU Octave - Bugs: bug #53311, Need a function to directly...


bug #53311: Need a function to directly compute npr.

Submitted by:  jack Bonz <vitalityz>
Submitted on:  Fri 09 Mar 2018 04:39:13 PM UTC  
Category: Octave FunctionSeverity: 1 - Wish
Priority: 5 - NormalItem Group: Feature Request
Status: NoneAssigned to: None
Originator Name: Open/Closed: Open
Release: 4.2.1Operating 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)

Tue 13 Mar 2018 06:06:10 PM UTC, comment #8:

No problem,I will be Always there.
If there comes compatibility issue or any issue,
I,myself will try to fix that.Actually I need the patch to be merged.Welcome any suggestions.

Dildar Sk <hodor123456>
Tue 13 Mar 2018 05:40:47 PM UTC, comment #7:

I am only offering my opinion as a member of the Octave community. I am leaving this open for now for others to weigh in.

My opinion is that this function should not be added to Octave, mainly for compatibility reasons.

There are two compatibility reasons to consider:

1. When Octave invents a new function that is not already in Matlab, there is a potential for Matlab to create a function in the future that conflicts with it.

The mitigation for this is that Octave chooses names that are not likely to be used by Matlab. For this case, I would suggest a name like "num_ordered_subsets" or "num_sequences_without_repetition".

2. Matlab does not provide the function that you are looking for, so anyone familiar with Matlab or who wants to write scripts that are compatible with Matlab already must express this in terms of factorial, nchoosek, or pochhammer. Since Octave already supports all of those functions, we are fully compatible. If Octave introduces a new function, users who want to remain Matlab compatible will have to avoid using it.

Additionally, I am not a mathematician, but I gather there is some naming confusion about permutations vs ordered subsets vs sequences without repetition. If this function were added to Octave, it would probably be best to avoid using the word permutation for this function, because permutations are orderings of the complete set, not subsets, i.e. factorial(n).

Mike Miller <mtmiller>
Project Administrator
Tue 13 Mar 2018 02:35:05 AM UTC, comment #6:

Here I am submitting a raw version of that function.
Attached a patch.

(file #43533)

Dildar Sk <hodor123456>
Sat 10 Mar 2018 12:02:10 AM UTC, comment #5:

Thank you Dildar.Your code serves my purpose but I think this function should be implemented as built in.
And I don't think there is any compatibility issue in implementing this function.There is many trivial functions,which is 'simple' to calculate.

jack Bonz <vitalityz>
Fri 09 Mar 2018 10:31:20 PM UTC, comment #4:

As you told the function is too simple and repetitive,
I changed it.And can't we implement functions if Matlab
do not so.Attached a m-file.

(file #43501)

Dildar Sk <hodor123456>
Fri 09 Mar 2018 06:32:38 PM UTC, comment #3:

I don't believe Matlab has a function for the number of permutations without repetition. And since it is such a simple expression to calculate based on nchoosek, I doubt there is a need for us to invent a function where Matlab hasn't already done so.

Leaning towards closing as wont fix.

Mike Miller <mtmiller>
Project Administrator
Fri 09 Mar 2018 04:50:14 PM UTC, comment #2:

Sorry,the previous file was not properly written.
I edited that(for credibility issue).

(file #43499)

Dildar Sk <hodor123456>
Fri 09 Mar 2018 04:43:40 PM UTC, comment #1:

I doubt it,
Whatever if there is no inbuilt function available
please add my m-file what implemented.
m-file is attached.

(file #43498)

Dildar Sk <hodor123456>
Fri 09 Mar 2018 04:39:13 PM UTC, original submission:

There is a function available to compute ncr i.e nchoosek(n,r);
but there is not function available to directly compute npr.
It would be helpful if there was a function available.

jack Bonz <vitalityz>


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

Attach File(s):

Attached Files
file #43533:  npermutek.patch added by hodor123456 (2KiB - text/x-patch)
file #43501:  npermuter.m added by hodor123456 (2KiB - text/x-objcsrc)
file #43499:  npermuter.m added by hodor123456 (1KiB - text/x-objcsrc)
file #43498:  npermuter.m added by hodor123456 (74B - text/x-objcsrc)


Depends on the following items: None found

   patch dependencies.


Carbon-Copy List
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by hodor123456 (Updated the item)
  • -unavailable- added by vitalityz (Submitted the item)

    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 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 13 Mar 2018 02:35:05 AM UTChodor123456Attached File-=>Added npermutek.patch, #43533
    Fri 09 Mar 2018 10:31:20 PM UTChodor123456Attached File-=>Added npermuter.m, #43501
    Fri 09 Mar 2018 06:32:38 PM UTCmtmillerSeverity3 - Normal=>1 - Wish
    Fri 09 Mar 2018 04:50:14 PM UTChodor123456Attached File-=>Added npermuter.m, #43499
    Fri 09 Mar 2018 04:43:40 PM UTChodor123456Attached File-=>Added npermuter.m, #43498

    Back to the top

    Powered by Savane 3.1-cleanup1