patchGNU Octave - Patches: patch #9095, Additional note for ppval and/or...


patch #9095: Additional note for ppval and/or mkpp documentation

Submitted by:  Martin Kunz <mkunz>
Submitted on:  Mon 22 Aug 2016 03:16:04 PM UTC  
Category: Core : otherPriority: 5 - Normal
Status: NonePrivacy: Public
Assigned to: NoneOpen/Closed: Open

Add a New Comment(Rich Markup)

You are not logged in

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


Sat 27 Aug 2016 06:00:15 AM UTC, comment #1:

New try to post the proposed note completely:

Martin Kunz <mkunz>
Mon 22 Aug 2016 03:16:04 PM UTC, original submission:

It took me a while to realise why the evaluation of piecewise polynomials constructed with mkpp does not work as I expected. Consider this example (a test case from ppval):
b = 1:3;
c = ones (2);
pp = mkpp (b, c);
ppval (pp, 1.1)

I thought we would calculate 1xi + 1 at xi=1.1 and expected the answer to be 2.1, but in fact this computation yields 1.1. The reason is that ppval subtracts the left break from xi and calculates 10.1 + 1 = 1.1.

I tried this code in MATLAB and got the same result, so the behaviour is consistent and we should not change it. If the piecewise polynomials are created by spline or interp1, all is fine (probably, I did not test), but when they are generated "by hand" with mkpp great confusion can arise. Therefore I suggest to add a note to the help of ppval and/or mkpp:

By the way, MATLAB includes a remark on this behaviour in the help on mkpp, but I find it rather cryptic: "Notice that mkpp shifts the polynomial in each interval down by (X-breaks(i))." I would even say it is wrong because mkpp shifts nothing.

Best regards,

Martin Kunz <mkunz>


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

Attach File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by mkunz (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 logged-in users can vote.


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



    No Changes Have Been Made to This Item

    Back to the top

    Powered by Savane 3.1-cleanup1