OriginLab Corporation - Data Analysis and Graphing Software - 2D graphs, 3D graphs, Contour Plots, Statistical Charts, Data Exploration, Statistics, Curve Fitting, Signal Processing, and Peak Analysis


 

File Submission

Submit Files

Update Files

Guidelines

Add New Category


 

 Search:

 

 
 

File Exchange > Category:Mathematics >
   Finding Roots of Equations

Author:

OriginLab Technical Support

Date Added:

11/6/2003

Downloads:

1676

Last Update:

11/6/2003

Total Ratings:

2

File Size:

87461 Bytes

Average Rating:

File Name:

Find_Roots.opj

Created Using:

Origin 7.5

File Version:

1.0

Working Versions:

7.5

License:

Free

Summary:

This Origin Project file can be used to find roots of equations. This project needs Origin version 7.5 or higher.

Description:

This is an Active Origin Project - it uses a new feature of Origin 7.5 that allows attaching files to an OPJ. This OPJ has an Origin C file, a worksheet template, and a graph template attached to it.

How to find roots of equations:
-------------------------------
You need to issue a command from the script window, where you specify the equation and the x range in which to find roots. If roots are found for the equation in the specified x range, a graph of the equation is created and the roots are marked on the graph. A hidden worksheet is
also created that contains the data plotted in the graph. The roots are also reported to the script window.

For example, to find roots of the equation:
sin(x)/x = 0.1
in the x range of -10 to 10, enter the following command in the script window and press the Enter key:
find_roots "sin(x)/x-0.1" -10 10

Note that
1> The equation has to be written in the form f(x) = 0 and you then enter only the f(x) part in the command.
2> Only one variable is supported and it has to be named x.
3> The equation has to be entered with quotes around it.
4> In your equation, you can use any mathematical function that is part of the ANSI C function set, or is part of the Origin C function set. For example, there is no sec(x) in ANSI C. So you will need to write that as 1/cos(x).

Algorithm for finding roots:
----------------------------
This sample uses a very simple algorithm, as follows:
a> In the x range specified by user, all intervals that contain a sign change in the function are first located.
b> Each such interval is checked to see if the function is monotonic within that interval.
c> In each of the intervals where the function is monotonic, a bisectional root search is performed: The interval is successively divided in half until either the maximum number
of iterations is exceeded, or the root is found to a preset precision. The max iterations and root precision are set in the Origin C code as constants, and can be changed.

To view the code associated with this OPJ, go to
Code Builder (menu item: View|Code Builder) and look at the Origin C file called find_roots.c in the Project branch of the Code Builder workspace tree.

Screen Shot:

img
 

Reviews:

Rated by: fandahan1987

Date: (2/22/2012 1:49:47 AM)

Rated by: reza

Date: (11/16/2003 10:51:25 PM)

Submit Your Own Review

Please use this form to review this File Exchange submission. Please do not use this form to report a problem, bug, or suggestion. Instead, please contact the person who submitted this File Exchange item by clicking here.

User ID:   Password  
Join here

How would you rate this? (on a scale of 1 to 5, with 5 being extremely useful)
1    2    3    4    5

Your Comments (no bug reports please):

© OriginLab Corporation. All rights reserved.