The Warwick Mathematics Society Website

User login

Upcoming events

  • No upcoming events available

There are 497 members of the Warwick Mathematics Society, of which 0 are new today!
We're 99% of the way toward our target of 500 members.
You can join up on the UWSU website.

OCTAVE

Post Icon Posted: Submitted by mauhbc on 13 February 2008 - 8:07pm.

Joined: 2007-10-08
Posts: 12

i dont understand why a file i know runs correctly in MATLAB has this error on OCTAVE
error: `newt1a' undefined near line 2 column 1

Post Icon Posted: 13 February 2008 - 8:23pm

Joined: 2006-10-09
Posts: 327

mauhbc: could you copypasta the newt1a program here so I can find out what the problem is. It's probably a minor difference in notation between MATLAB and octave, I'll see if I can sort it.

Jamie

Post Icon Posted: 13 February 2008 - 11:34pm

Joined: 2006-08-31
Posts: 694

Whoops, sorry cosmin, I edited your comment by mistake, instead of replying to it.

Post Icon Posted: 13 February 2008 - 11:46pm

Joined: 2007-10-03
Posts: 373

Yeah sorry Jamie, Cosmin has 1 more math power than you

Post Icon Posted: 14 February 2008 - 12:56am

Joined: 2006-10-09
Posts: 327

What was it that Cosmin said? I missed that...

Jamie

Post Icon Posted: 14 February 2008 - 1:01am

Joined: 2006-08-31
Posts: 694

That mauhbc should change his username to PBiG or somesuch

Post Icon Posted: 14 February 2008 - 1:16am

Joined: 2007-10-03
Posts: 373

What ? No he didn't... He said that he could try and sort it out too, and that it would be him or Jamie following popular demand.
He also said he's giving up maths

Post Icon Posted: 14 February 2008 - 1:32am

Joined: 2006-08-31
Posts: 694

No, Cosmin said: he should change his username to PBiG, I said (by incorrectly editing cosmin's post): I could change his username, by popular demand.

Post Icon Posted: 14 February 2008 - 1:44am

Joined: 2007-10-08
Posts: 12

ATTAHCED AS WORD

ps ill decide to change my username, noone else!

AttachmentSize
NEWT1A.doc24 KB
Post Icon Posted: 14 February 2008 - 1:48am

Joined: 2006-08-31
Posts: 694
Or:

% Uses Newton-Raphson to estimate the roots of x^3-4x^2-x+2 = 0

x = 5 % Input initial guess
tol = 10^(-15); % Sets tolerance.

xdiff = inf; % initializes difference between successive estimates
k=1; % initializes counter

while xdiff > tol
k=k+1;
x(k) = x(k-1) - ((x(k-1)^3)-(4*x(k-1)^2)-(x(k-1))+(2))/((3*x(k-1)^2)-(8*x(k-1))-(1));
xdiff = abs(x(k)-x(k-1));
end
t=-2:0.001:5
y=t.*t.*t-4*t.*t-t+2
plot(t,y);

x' % Print out column vector of approximations
Post Icon Posted: 14 February 2008 - 1:53am

Joined: 2006-08-31
Posts: 694

Given the error message it seems that the issue is how you call this code, not the code itself.

Post Icon Posted: 14 February 2008 - 2:23am

Joined: 2006-11-02
Posts: 1004

Yes, please do change the name, I don't think anyone would oppose that. :D

Edit: "ps ill decide to change my username, noone else!" Hadn't noticed that. Still, that's just one person. :p

Post Icon Posted: 14 February 2008 - 2:29am

Joined: 2007-03-03
Posts: 129

I know that his fluffed-up conceit is rather amusing, but let's not be cruel to him.

Post Icon Posted: 14 February 2008 - 2:40am

Joined: 2006-10-10
Posts: 518

Posted in same thread...

Post Icon Posted: 14 February 2008 - 2:42am

Joined: 2006-11-02
Posts: 1004

It's not cruel at all, it's useful. At least people will (sort of) know who's writing the messages.

Post Icon Posted: 14 February 2008 - 3:30am

Joined: 2006-10-09
Posts: 327

I suspect that it's one of 2 things - 1) Octave doesn't like linebreaks (unlikely, but possible) - fix is to remove all blank lines from your m-file. 2) the way you're calling it is incorrect - best to send us the exact command you're using to call it.

Jamie

Post Icon Posted: 14 February 2008 - 11:08am

Joined: 2007-10-08
Posts: 12

IT WORKS ON MATLAB SO WHY NOT OCTAVE
I dont understand what u mean by calling it incorrectly
ps if someone changed my nick, i wouldnt be able to login as my own username would be wrong

Post Icon Posted: 14 February 2008 - 1:04pm

Joined: 2006-10-01
Posts: 427

IT WORKS ON MATLAB SO WHY NOT OCTAVE

See, if you're calling it like that,you're bound to get a problem: petulance gives a syntax error in octave.

He means "what did you type to tell octave to start the file running?"

Post Icon Posted: 14 February 2008 - 2:03pm

Joined: 2006-08-31
Posts: 694

Lol, ii was a joke, I wouldn't change anyone's username except mine. But yeah, how are you making OCTAVE execute your code?

Post Icon Posted: 14 February 2008 - 3:14pm

Joined: 2006-11-02
Posts: 1004
IT WORKS ON MATLAB SO WHY NOT OCTAVE
He's yelling at it. Besides, Octave had already gotten annoyed with his incessant checking of conjectures (for n < 16). It just decided to give a random error message.