|
From: Stavros M. (Σ. Μ. <mac...@al...> - 2016-09-29 16:17:58
|
* In general, it is hard to help solve a problem without a small,
reproducible example. I understand that your actual problem is
confidential, but it is usually possible to reduce a problem to something
which causes the same issue, but is much smaller, and doesn't reveal
confidential information. For example, your problem may have 30 terms; try
deleting half the terms and see if you still have the problem; then repeat
until you don't have the problem.
* The first argument to find_root should be an expression that evaluates to
a number. Your first argument appears to be a list, [...] (perhaps a list
of one element, but that's still a list).
* Your function is discontinuous. find_root is specified to work for
*continuous* functions. You might want to look for solutions to each of the
continuous sections of the function.
* If the continuous sections of the function are all polynomials, instead
of find_root, you should use realroots, which does not require you to find
endpoints of different sign, returns all roots (not just one), and is
faster.
* I would recommend analyzing your function into something like:
[ [min,max,poly] , ... ]
Then calling realroots on each poly, filtering the results by the min-max
ranges.
On Wed, Sep 28, 2016 at 6:30 AM, André Fettouhi <a.f...@gm...>
wrote:
> A follow-up on my issue finding the full width at half height. I have
> tried using the find_root instead so I define a function f(x)
>
> /* [wxMaxima: input start ] */
> f(x) := -SplineSFitCrossCorr[1](x) - CrossCorrelationsShift[1]/2$
> /* [wxMaxima: input end ] */
>
> where -SplineSFitCrossCorr[1](x) is the spline I have made based on the
> data and CrossCorrelationsShift[1]/2 is the half height of the peak I am
> trying to find the width of. Then I run this
>
> find_root(f(x),x,-15,15)
>
> and I get this output (showing only part of it)
>
> find_root([-(1.644898582136851*10^-4*x^3+0.007402043619615831*x^2+0.
> 1081554815930787*x+0.4957946062003042)*
> charfun(x<-14)-charfun(4<=x and x<5)*
> (1.117076017317504*10^-4*x^3-0.001802508781380471*x^2+0.
> 001147908066100174*x+0.040843879341963)-charfun(5<=x and x<6)*
> (1.073977735114262*10^-4*x^3-0.001737861358075608*x^2+8.
> 24670949575862*10^-4*x+0.04138260786950352)-
> charfun(3<=x and x<4)*(1.052478698634486*10^-4*
> x^3-0.00172499199896085*x^2+8.378409364216931*10^-4*x+0.0412573021815343)-
> charfun(6<=x and x<7)*
> (9.379365045859012*10^-5*x^3-0.001492987143124559*x^2-6.
> 445743401304309*10^-4*x+0.04432109844891611)-
> charfun(2<=x and x<3)*
> (8.728363099403584*10^-5*x^3-0.001563313849136134*x^2+.....,-
> 15.0,15.0)
>
> Why isn't it evaluating it? Or am I using find_root wrong? There should be
> two solutions f(x).
>
> ------------------------------------------------------------
> ------------------
>
> _______________________________________________
> Maxima-discuss mailing list
> Max...@li...
> https://lists.sourceforge.net/lists/listinfo/maxima-discuss
>
>
|