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 : other Priority:  5 - Normal
Status:  None Privacy:  Public
Assigned to:  None Open/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 1*xi + 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 1*0.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 Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by mkunz (Submitted the item)

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

    Only logged-in users can vote.




    No changes have been made to this item

    Back to the top

    Powered by Savane 3.3