Re: Doubs in Gsoc chebfun project: getting error while running g=f+1, needed tips to resolve it.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Doubs in Gsoc chebfun project: getting error while running g=f+1, needed tips to resolve it.

Colin Macdonald-2
On 2018-03-06 05:52 PM, Saurav Malani wrote:
> As I was proceeding as per your instructions in octave gsoc page under chebfun, I am facing few problems.
>
> 1. As you told that "f = chebfun(@(x) sin(x), [-2 6])" and f(pi) should work. I would say yes it works fine, but when I cross checked the answer with matlab answer, there was a significant difference.
> octave output:1.1102e-16
> matlab output:3.3307e-16

Well, those are machine precision.  So I would say difference is
(probably) insignificant.  Try f(pi/3) for example and compare those.
Difference b/w Octave and Matlab should be O(eps)---if not, that's a bug.

> 2. Also, as you mentioned that g=f+1 should also work. But, when I try this, I get this error.
>>> g=f+1
>
> g =
>
>     chebfun column1 (1 smooth piece)
>         interval       length     endpoint values
> [      -2,       6]       24     0.091     0.72
> vertical scale =   2
>
> error: 'infoJ' undefined near line 47 column 19
> error: called from
>      dispData at line 47 column 1
>      disp>colDisp at line 76 column 22
>      disp at line 50 column 9
>      display at line 34 column 5
>
>>> g(pi)
> error: out(_,2): but out has size 1x1
> error: called from
>      subsref at line 112 column 17.
>
> so, to debug it, I just want to know what is the first function (.m file) to be called when we enter something like g=f+1. so that I can track further for which function is being called and may try to figure out region for possible problem? Also, in general what is the best method in octave to debug, I am using grep command to find where it is used or called and in this way I am proceeding, but this is a bit slow and inefficient method. Any tips on this?

What version of Octave?  I was tested with a recent development version.
  I think I get this same error on Octave 4.2.1.

You can try and debug it by looking at the list of functions called
("distData, disp->colDisp", etc.

Look at the output of "class(f)" to see where to look for these functions...

You will need to be able to work with the development version of Octave
if you want to do GSoC so maybe there?  This should be documented on the
wiki.

>     Also, I looked into the github repo[1] as pointed out, to be a good place to start. But, to be honest I didn't deduce much from it. Just found that you changed f.funs to ffuns. I tried tracking this also, but did not found anything.
 >
 > [1]
https://github.com/cbm755/chebfun/commit/e20b0ad2dc89cfe8e50ba461b864eff7d5bbef17
 >
>     Also, I didn't understand why you wrote ffuns=f.funs, what difference is this making?

Why not try switching it back and see what happens...?

It makes a difference because of the way object oriented programming
works in Octave.  There are subtle differences in how OO is implemented
in Octave versus Matlab.  The task here is whether we can workaround
that difference (in chebfun code) or whether its a bug in Octave (and
needs  to be fixed in Octave).

best,
Colin


-----------------------------------------
Join us March 12-15 at CERN near Geneva
Switzerland for OctConf 2018.  More info:
https://wiki.octave.org/OctConf_2018
-----------------------------------------
Reply | Threaded
Open this post in threaded view
|

Re: Doubs in Gsoc chebfun project: getting error while running g=f+1, needed tips to resolve it.

Saurav Malani
Hi sir,
Thanks for the insight.

So, I was looking at the @chebfun/disp.m function, and I think that "disp" function will throw error in case of complex number. As in case of complex number sprintf calls f.domain(f) (line-89). So, we need to declare "temp" outside if and else condition of that for loop (i.e. around line 82, may be somewhere around ffuns).
   Although, as you said that this is a temporary work around, and we need to find a permanent fix for this. But I failed to find any such permanent fix, maybe because of the implementation of OOPs in Octave. Is is because of static methods?  
   Now, I am working on subsref.m, although I tied few things, but all failed, maybe because of lack of insights. But, I am still hopeful that with few tweaks I will fix it.
   But, now as we are left with only 2 weeks (of gsoc proposal submission deadline), so can you suggest the permanent fix for it? You mentioned little bit about this in the Aim column of the chebfun project of the project list, but I didn't understand it properly. so, it will be a great help if you can explain what do I need to do to fix it permanetly in detail, as this is one of the AIM of the project.
   
Thanks,
Regards,
Saurav Malani  

----- Original Message -----
From: "Colin Macdonald" <[hidden email]>
To: "Saurav Malani" <[hidden email]>, [hidden email]
Sent: Thursday, March 8, 2018 11:34:23 PM
Subject: Re: Doubs in Gsoc chebfun project: getting error while running g=f+1, needed tips to resolve it.

On 2018-03-06 05:52 PM, Saurav Malani wrote:
> As I was proceeding as per your instructions in octave gsoc page under chebfun, I am facing few problems.
>
> 1. As you told that "f = chebfun(@(x) sin(x), [-2 6])" and f(pi) should work. I would say yes it works fine, but when I cross checked the answer with matlab answer, there was a significant difference.
> octave output:1.1102e-16
> matlab output:3.3307e-16

Well, those are machine precision.  So I would say difference is
(probably) insignificant.  Try f(pi/3) for example and compare those.
Difference b/w Octave and Matlab should be O(eps)---if not, that's a bug.

> 2. Also, as you mentioned that g=f+1 should also work. But, when I try this, I get this error.
>>> g=f+1
>
> g =
>
>     chebfun column1 (1 smooth piece)
>         interval       length     endpoint values
> [      -2,       6]       24     0.091     0.72
> vertical scale =   2
>
> error: 'infoJ' undefined near line 47 column 19
> error: called from
>      dispData at line 47 column 1
>      disp>colDisp at line 76 column 22
>      disp at line 50 column 9
>      display at line 34 column 5
>
>>> g(pi)
> error: out(_,2): but out has size 1x1
> error: called from
>      subsref at line 112 column 17.
>
> so, to debug it, I just want to know what is the first function (.m file) to be called when we enter something like g=f+1. so that I can track further for which function is being called and may try to figure out region for possible problem? Also, in general what is the best method in octave to debug, I am using grep command to find where it is used or called and in this way I am proceeding, but this is a bit slow and inefficient method. Any tips on this?

What version of Octave?  I was tested with a recent development version.
  I think I get this same error on Octave 4.2.1.

You can try and debug it by looking at the list of functions called
("distData, disp->colDisp", etc.

Look at the output of "class(f)" to see where to look for these functions...

You will need to be able to work with the development version of Octave
if you want to do GSoC so maybe there?  This should be documented on the
wiki.

>     Also, I looked into the github repo[1] as pointed out, to be a good place to start. But, to be honest I didn't deduce much from it. Just found that you changed f.funs to ffuns. I tried tracking this also, but did not found anything.
 >
 > [1]
https://github.com/cbm755/chebfun/commit/e20b0ad2dc89cfe8e50ba461b864eff7d5bbef17
 >
>     Also, I didn't understand why you wrote ffuns=f.funs, what difference is this making?

Why not try switching it back and see what happens...?

It makes a difference because of the way object oriented programming
works in Octave.  There are subtle differences in how OO is implemented
in Octave versus Matlab.  The task here is whether we can workaround
that difference (in chebfun code) or whether its a bug in Octave (and
needs  to be fixed in Octave).

best,
Colin


-----------------------------------------
Join us March 12-15 at CERN near Geneva
Switzerland for OctConf 2018.  More info:
https://wiki.octave.org/OctConf_2018
-----------------------------------------
Reply | Threaded
Open this post in threaded view
|

Re: Doubs in Gsoc chebfun project: getting error while running g=f+1, needed tips to resolve it.

Colin Macdonald-2
On 2018-03-12 05:18 AM, Saurav Malani wrote:
> So, I was looking at the @chebfun/disp.m function, and I think that "disp" function will throw error in case of complex number. As in case of complex number sprintf calls f.domain(f) (line-89). So, we need to declare "temp" outside if and else condition of that for loop (i.e. around line 82, may be somewhere around ffuns).
>     Although, as you said that this is a temporary work around, and we need to find a permanent fix for this. But I failed to find any such permanent fix, maybe because of the implementation of OOPs in Octave. Is is because of static methods?
>     Now, I am working on subsref.m, although I tied few things, but all failed, maybe because of lack of insights. But, I am still hopeful that with few tweaks I will fix it.
>     But, now as we are left with only 2 weeks (of gsoc proposal submission deadline), so can you suggest the permanent fix for it? You mentioned little bit about this in the Aim column of the chebfun project of the project list, but I didn't understand it properly. so, it will be a great help if you can explain what do I need to do to fix it permanetly in detail, as this is one of the AIM of the project.

1.  Have you tested with development branch of octave?  Does the disp
work there?

2.  Under "first steps" on the wiki, making "2*f" work is suggested.
Perhaps that is a good first step?

Colin


-----------------------------------------
Join us March 12-15 at CERN near Geneva
Switzerland for OctConf 2018.  More info:
https://wiki.octave.org/OctConf_2018
-----------------------------------------
Reply | Threaded
Open this post in threaded view
|

Re: Doubs in Gsoc chebfun project: getting error while running g=f+1, needed tips to resolve it.

Saurav Malani


----- Original Message -----
From: "Colin Macdonald" <[hidden email]>
To: "Saurav Malani" <[hidden email]>, "Octave Maintainers List" <[hidden email]>
Sent: Monday, March 12, 2018 11:23:36 PM
Subject: Re: Doubs in Gsoc chebfun project: getting error while running g=f+1, needed tips to resolve it.

On 2018-03-12 05:18 AM, Saurav Malani wrote:
> So, I was looking at the @chebfun/disp.m function, and I think that "disp" function will throw error in case of complex number. As in case of complex number sprintf calls f.domain(f) (line-89). So, we need to declare "temp" outside if and else condition of that for loop (i.e. around line 82, may be somewhere around ffuns).
>     Although, as you said that this is a temporary work around, and we need to find a permanent fix for this. But I failed to find any such permanent fix, maybe because of the implementation of OOPs in Octave. Is is because of static methods?
>     Now, I am working on subsref.m, although I tied few things, but all failed, maybe because of lack of insights. But, I am still hopeful that with few tweaks I will fix it.
>     But, now as we are left with only 2 weeks (of gsoc proposal submission deadline), so can you suggest the permanent fix for it? You mentioned little bit about this in the Aim column of the chebfun project of the project list, but I didn't understand it properly. so, it will be a great help if you can explain what do I need to do to fix it permanetly in detail, as this is one of the AIM of the project.

1.  Have you tested with development branch of octave?  Does the disp
work there?

-> Yes, I did, as you mentioned, that I should work with development version.

2.  Under "first steps" on the wiki, making "2*f" work is suggested.
Perhaps that is a good first step?

-> Yes, I am working on it. But as only 2 weeks are left for the deadline of project proposal, so for now I am focusing more on preparation of proposals. So, can you please help me with this by answering questions related to proposal in the previous mail.

Thanks,
Regards,
Saurav Malani


-----------------------------------------
Join us March 12-15 at CERN near Geneva
Switzerland for OctConf 2018.  More info:
https://wiki.octave.org/OctConf_2018
-----------------------------------------