Bug #1095

trend1d -Nf

Added by Marcelo 9 days ago. Updated 7 days ago.

Status:In ProgressStart date:2017-05-13
Priority:NormalDue date:
Assignee:-% Done:


Target version:-
Affected version:5.x-svn Platform:


the following command don't end (need to use ctr+c to stop it):

gmt math -T10/110/1 T 25 DIV 2 MUL PI MUL COS = | gmt trend1d -f0-1f -Nf1+o0+l25 -Fp

using with option -Vd (see attached file), say that it try to solve:
y(x) = a + b * cos (1*x) + c * sin (1*x)

but after that it says that is trying to solve a polynomial:
20:trend1d: The partial polynomial will be represented via powers of x
35:trend1d: Convert from normalized polynomial to user-domain polynomial coefficients

A small modification make it finish and return what I expected:

gmt math -T10/110/1 T 25 DIV 2 MUL PI MUL COS = | gmt trend1d -f0-1f -NF1+o0+l25 -Fp
1       -2.94902990916e-16

I could check that in this case it try to solve:
y(x) = a * cos (1*x) + b * sin (1*x)

I was trying to work with -Nf option, but I'm geting strange results.

using 5.5.1_r18212

trend1d-Nf.log (2.25 KB) Marcelo, 2017-05-13 11:00


#1 Updated by Joaquim 7 days ago

  • Status changed from New to In Progress

Hangs because in unscale_polynomial () L#450, and given that n=1, it falls into an infinite loop

    for (j = 0; j <= n - 2; j++) {
        for (k = n - 1; k > j; k--) c[k-1] -= cnst * c[k];

Also available in: Atom PDF