Problem with Integration-1.0.6 package

View: New views
8 Messages — Rating Filter:   Alert me  

Problem with Integration-1.0.6 package

by Marcin Sleczka :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I've got a strange problem. I've installed an extra package integration-1.0.6. I've got it on the package list and it loads automatically.
I create a .m file which contain such a code:

function y=test
y=quad2dg('exy', 0, 1, 0, 1);
endfunction;

function v=exy(x,y)
v=x.^2.+y.^3;
endfunction;

Then I call it from octave. I obtain some errors, but I don't know why:
warning: meshdom is obsolete and will be removed from a future version of Octave; please use meshgrid instead
error: feval: the symbol `exy' is not valid as a function
error: evaluating assignment expression near line 60, column 4
error: called from `gquad2d' in file `/Applications/Octave.app/Contents/Resources/share/octave/packages/integration-1.0.6/gquad2d.m'
error: evaluating assignment expression near line 32, column 8
error: called from `quad2dg' in file `/Applications/Octave.app/Contents/Resources/share/octave/packages/integration-1.0.6/quad2dg.m'
error: evaluating assignment expression near line 2, column 2
error: called from `test' in file `/Users/macin/Documents/Doktorat/Programowanie/Octave/funkcje/moje/test.m'


When I paste this code directly into octave everything is fine and I obtain the expected result:
ans =  0.58333

Problem with Integration-1.0.6 package

by John W. Eaton-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On  5-Mar-2009, Marcin Sleczka wrote:

|
| I've got a strange problem. I've installed an extra package
| integration-1.0.6. I've got it on the package list and it loads
| automatically.
| I create a .m file which contain such a code:
|
| function y=test
| y=quad2dg('exy', 0, 1, 0, 1);
| endfunction;
|
| function v=exy(x,y)
| v=x.^2.+y.^3;
| endfunction;
|
| Then I call it from octave. I obtain some errors, but I don't know why:
| warning: meshdom is obsolete and will be removed from a future version of
| Octave; please use meshgrid instead
| error: feval: the symbol `exy' is not valid as a function
| error: evaluating assignment expression near line 60, column 4
| error: called from `gquad2d' in file
| `/Applications/Octave.app/Contents/Resources/share/octave/packages/integration-1.0.6/gquad2d.m'
| error: evaluating assignment expression near line 32, column 8
| error: called from `quad2dg' in file
| `/Applications/Octave.app/Contents/Resources/share/octave/packages/integration-1.0.6/quad2dg.m'
| error: evaluating assignment expression near line 2, column 2
| error: called from `test' in file
| `/Users/macin/Documents/Doktorat/Programowanie/Octave/funkcje/moje/test.m'
|
|
| When I paste this code directly into octave everything is fine and I obtain
| the expected result:
| ans =  0.58333

If a .m file begins with a "function" keyword, then it can only define
one function.  Put each of your functions in separate files.

jwe
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: Problem with Integration-1.0.6 package

by Marcin Sleczka :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


John W. Eaton-3 wrote:
On  5-Mar-2009, Marcin Sleczka wrote:


| I create a .m file which contain such a code:
|
| function y=test
| y=quad2dg('exy', 0, 1, 0, 1);
| endfunction;
|
| function v=exy(x,y)
| v=x.^2.+y.^3;
| endfunction;


If a .m file begins with a "function" keyword, then it can only define
one function.  Put each of your functions in separate files.

jwe
_______________________________________________
Help-octave mailing list
Help-octave@octave.org
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Yes, I did create test.m file. The effect was the same.
Of course exy is a subfunction.

Re: Problem with Integration-1.0.6 package

by martin_helm :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Marcin Sleczka wrote:
John W. Eaton-3 wrote:
On  5-Mar-2009, Marcin Sleczka wrote:


| I create a .m file which contain such a code:
|
| function y=test
| y=quad2dg('exy', 0, 1, 0, 1);
| endfunction;
|
| function v=exy(x,y)
| v=x.^2.+y.^3;
| endfunction;


If a .m file begins with a "function" keyword, then it can only define
one function.  Put each of your functions in separate files.

jwe
_______________________________________________
Help-octave mailing list
Help-octave@octave.org
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Yes, I did create test.m file. The effect was the same.
Of course exy is a subfunction.
I just tested this within one script file and exy as a subfunction. The simple thing is quad2dg will use feval if you pass the function name as a string which then cannot find a subfunction.

Use a function handle instead
y=quad2dg(@exy, 0, 1, 0, 1);

Then it works also with exy as subfunction


Re: Problem with Integration-1.0.6 package

by Marcin Sleczka :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


martin_helm wrote:
I just tested this within one script file and exy as a subfunction. The simple thing is quad2dg will use feval if you pass the function name as a string which then cannot find a subfunction.

Use a function handle instead
y=quad2dg(@exy, 0, 1, 0, 1);

Then it works also with exy as subfunction
It work's, thanks. But I've got one warning:
warning: meshdom is obsolete and will be removed from a future version of Octave; please use meshgrid instead
Should I be concerned about this warning?

Re: Problem with Integration-1.0.6 package

by martin_helm :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> martin_helm wrote:
> > I just tested this within one script file and exy as a subfunction. The
> > simple thing is quad2dg will use feval if you pass the function name as a
> > string which then cannot find a subfunction.
> >
> > Use a function handle instead
> > y=quad2dg(@exy, 0, 1, 0, 1);
> >
> > Then it works also with exy as subfunction
>
> It work's, thanks. But I've got one warning:
> warning: meshdom is obsolete and will be removed from a future version of
> Octave; please use meshgrid instead
> Should I be concerned about this warning?

Which version are you using? 3.0.3 does not show this warning on my linux
machine.

_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: Problem with Integration-1.0.6 package

by Marcin Sleczka :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


martin_helm wrote:

Which version are you using? 3.0.3 does not show this warning on my linux
machine.
Octave 3.0.3 on Leopard 10.5.6

Re: Problem with Integration-1.0.6 package

by martin_helm :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> martin_helm wrote:
> > Which version are you using? 3.0.3 does not show this warning on my linux
> > machine.
>
> Octave 3.0.3 on Leopard 10.5.6

Sorry, I simply missed that my version also showed this message the first time
I invoked quad2dg, the second time it is of course not shown.

This should be reported to the package maintainer for the integration package.

- mh

_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave