Insights Blog
-- Browse All Articles --
Physics Articles
Physics Tutorials
Physics Guides
Physics FAQ
Math Articles
Math Tutorials
Math Guides
Math FAQ
Education Articles
Education Guides
Bio/Chem Articles
Technology Guides
Computer Science Tutorials
Forums
Chemistry
Biology and Medical
Earth Sciences
Computer Science
Computing and Technology
DIY Projects
Trending
Featured Threads
Log in
Register
What's new
Search
Search
Search titles only
By:
Chemistry
Biology and Medical
Earth Sciences
Computer Science
Computing and Technology
DIY Projects
Menu
Log in
Register
Navigation
More options
Contact us
Close Menu
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Forums
Other Sciences
Programming and Computer Science
Scientific Computing: Method of Undetermined Coefficients in Python
Reply to thread
Message
[QUOTE="bigfooted, post: 6472234, member: 377103"] You can almost literally use that MATLAB script in python. Just copy the entire contents of the function into e.g. a jupyter notebook cell and run it (not as a function but just the contents of the function). Then start at line 1 and fix it line by line into python code. For instance, the first line is n=length(x), so before this line you start by defining the inputs. Define an array of coordinates called x: [CODE=python] import numpy as np x = np.array([0.0, 0.1, 0.2]) [/CODE] and then you find out that the command for length() is called len() in python [CODE=python] n = len(x) [/CODE] etc. It is a very basic code, so some self-learning of python and numpy for an hour should give you enough background to finish the porting to python. You can start here and follow the basic python tutorial and then the numpy tutorial: [URL]https://www.w3schools.com/python/python_syntax.asp[/URL] [/QUOTE]
Insert quotes…
Post reply
Forums
Other Sciences
Programming and Computer Science
Scientific Computing: Method of Undetermined Coefficients in Python
Back
Top