octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 1D PDE solver for Octave


From: Carlo De Falco
Subject: Re: 1D PDE solver for Octave
Date: Tue, 5 Jul 2016 17:08:10 +0000

Bill,

On 5 Jul 2016, at 18:31, Bill Greene <address@hidden> wrote:

> Glad to hear you were able to build on OSX. I don't currently have access to 
> that platform.

This version of the Makefile should be relatively platform independent
as it relies on the "mkoctfile".

This is the standard approach used in all Octave packages.
Using a slightly improved version of this file you should
be able to quite easily reorganize your code into a package
using thie procedure described here:

https://www.gnu.org/software/octave/doc/interpreter/Creating-Packages.html#Creating-Packages

this is how Octave extesions are 

> Regarding the demo, it looks to me like the first "demo" line is
> %!demo
> I don't see an extra space.

there shoudn't be any, the first line must be exactly

%!demo

the space should be in the other lines, as described here:

https://www.gnu.org/software/octave/doc/interpreter/Demonstration-Functions.html#Demonstration-Functions


> I haven't yet tried on linux but when I do
> demo pde1d
> on windows, I get this error:
> error: element number 1 undefined in return list
> error: called from
>     demo at line 111 column 13
> 
> >Even if I fix this the demo does nothing useful, it defines a
> >bunch of functions but doesn't run anything.
> 
> OK, I just took the contents of one of my test m-files and put
> a %! in front of every line. So maybe there should be
> %!heatCond
> as the last line in the demo section to call the "main" function?

typing "demo pde1d" is equivalent to copying the contents of the demo 
blocks and typing "enter". If you do that, do you get any interesting result?

In the manual page for demo linked above, please read carefully the paragraph 
about
defining functions in a demo block:

'... Finally, because demo evaluates within a function context it is not 
possible to define new functions within the code. Anonymous functions make a 
good substitute in most instances. If function blocks must be used then the 
code eval (example ("function", n)) will allow Octave to see them. This has its 
own problems, however, as eval only evaluates one line or statement at a time. 
In this case the function declaration must be wrapped with "if 1 <demo stuff> 
endif" where "if" is on the same line as "demo" ...'

c.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]