LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-28-2019, 02:38 PM   #1
Rpin
LQ Newbie
 
Registered: Oct 2019
Posts: 1

Rep: Reputation: Disabled
Arrow Octave/Matlab


I'm newbie here, I'm a math student. Right now I'm doing a calculus work. I need to create an algoritm using octave/matlab, to solve non-linear systems. I found that code, but I can't compile it. I'm learning it yet. Anyone could help me?

function [x] = newton(F,JF,x0,TOL,N)
x = x0
k = 1
#iteracoes
while (k <= N)
#iteracao de Newton
delta = -inv(JF(x))*F(x)
x = x + delta
#criterio de parada
if (norm(delta,’inf’)<TOL) then
return
endif
k = k+1
endwhile
error('Maximum of iterations!')
endfunction
 
Old 10-28-2019, 03:04 PM   #2
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
Oops...duplicate post. see #3

Last edited by scasey; 10-28-2019 at 03:05 PM.
 
Old 10-28-2019, 03:04 PM   #3
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
What language is that code? What are the specifications of your system? What have you tried to do?
 
1 members found this post helpful.
Old 10-29-2019, 07:15 AM   #4
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by scasey View Post
What language is that code? What are the specifications of your system? What have you tried to do?
Matlab has their own libraries and variable types which greatly aids their environment which is obviously math focused.

This may be exactly that, or it may be a different language, designed with the same points in mind.

@Rpin,

Welcome to LQ.

Perhaps you ought to share if you have any information about compiling in general. Were you given a fundamental compile command, and a simple example which works with it? Or instead what tools and interface were you given to be able to create, edit, test, and submit your efforts using octave/matlab? Or when you say, "I'm learning it yet", was that a grammar incorrect statement to indicate that you hadn't yet learned how to compile, but it is an eventual part of the course, or that you're just starting with compiling these programs, but you haven't picked it up too well as yet? Either case, there likely should be aid available from a lab manager, instructor, or teaching assistant for that, please do seek them out to aid you with compiling programs.

For this problem, it might be better instead to write your intended algorithm, in an algorithm description language, which is very much similar to what that shows, but has more descriptiveness included with it. Like explains what F, JF, x0, TOL, and N are to represent.

Great that you found something, but do you understand it as well as agree with the logic which is written there? My read is that it is some calculation using Newtons, using change (delta), and performing N iterative calculations, making sure part of it doesn't exceed a TOL limit. OK, I'm rusty on my physics, but I guess the point of this here is that you're calculating upon a rate of change, which is linear algebra.

To be honest, my concern here is that you wish to just grab something you found on the web, and I'd half bet that if you got it compiled with zero fuss, that you'd turn it in? Call me incorrect there, sorry. I get it that sometimes one wishes to show progress and be successful, however it also is beneficial to ask if you're entirely out of wits with understanding an assignment so that you can get over that blocking point and move on to more interesting calculations. I'm suspecting that the whole point here is to start learning the octave/matlab coding conventions so that you'll master them and thus be able to express equations of greater and greater complexity. Best to start with the simple ones, versus debugging something, that someone else wrote.

Again, just a guess here, but if I was an instructor and one or more of my students was having difficulties even starting assignments, I'd like to know that so I could provide more adequate background for them.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Installed MATLAB in /home/c/Desktop/MATLAB But Cannot ACCESS it hitmen Linux - Newbie 10 09-25-2011 12:11 PM
Matlab Distributed Computing Server: Connecting to Matlab client fails OEP Linux - Server 0 12-21-2009 02:18 PM
Terminal cmd for starting Matlab M-file editor without starting matlab fubzot Linux - Software 2 02-15-2005 06:49 AM
Matlab, Scilab, Octave ... m!k@EL Linux - Software 4 01-01-2005 06:34 PM
Octave and SuSE 8.1? jkcunningham Linux - Software 0 11-11-2002 03:29 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration