The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Roots of a polynom equation
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

JokerOne

Germany
58 Posts

Posted - 02/18/2016 :  11:17:01 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. 9 and Service Release 1(Select Help-->About Origin):
Operating System: Win 7

Is there a LabTalk Command that provides the root of a polynom-equation, like
3x^3 -7.1527x = 0
to solve for all x that fulfills this equation.

e.g.:
dataset roots
coeff[1] = 3
coeff[2] = 0
coeff[3] = -7.1527
coeff[4] = 0
roots = find_roots(coeff)

The function is suppose to also work for polynom equation of higher order.

As as option, is there an option to investiage a polynom for maximum/minimum condition, etc?

Thanks for your help.

Hideo Fujii

USA
1582 Posts

Posted - 02/18/2016 :  2:15:43 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi JokerOne,

> Is there a LabTalk Command that provides the root of a polynom-equation, like
> 3x^3 -7.1527x = 0

To solve this numerically, the following should do that task:
col(1)=data(-100,100, 0.05);
col(2)=3*col(1)^3 -7.1527*col(1);
levelcrossing iy:=col(2) level:=0;
Hope this helps.

--Hideo Fujii
OriginLab

Edited by - Hideo Fujii on 02/18/2016 2:58:56 PM
Go to Top of Page

JokerOne

Germany
58 Posts

Posted - 02/19/2016 :  05:56:06 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks again,

may I continue with a question refering:

I would prefer, to store the result, i.e., the roots in a dataset rather than in a particular worksheet.
If I get the documentation correctly, this will then be called a loose dataset?
I tried to do this, but my syntax is properly not correct

dataset bbb;
col(2)=3*col(1)^3 -7.1527*col(1);
levelcrossing iy:=col(2) level:=0 oy:=bbb;
bbb[1]= [does not work]
bbb[2]= [does not work]

also, maybe, I cannot put the result of the the levelcrossing function in a dataset? When the documentation requests an "Output Vector" as datatype, is a [loose?-]dataset allowed?

Maybe, I can store the results in bbb, but I did not manage to access the dataset correctly?


Go to Top of Page

JokerOne

Germany
58 Posts

Posted - 02/19/2016 :  06:57:00 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I guess, that I found the correct syntax now.

I had an issue with providing the XYRange in levelcrossing correctly, at least that is what I am thinking.

Thanks again for the hint for the levelcrossing function, this is very helpful.

Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 02/19/2016 :  09:58:46 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

As a reference for public, the following is the workable code:
col(1)=data(-100,100, 0.05);
col(2)=3*col(1)^3 -7.1527*col(1);
range bbb = [??]!loose_a;  //to define the range of a loose dataset
levelcrossing iy:=col(2) level:=0 oy:=bbb;
bbb[1]=;
You can read the details about the loose dataset at:
http://www.originlab.com/doc/LabTalk/guide/Range-Notation#Loose_Dataset

--Hideo Fujii
OriginLab

P.S. You can also write the range string of the loose dataset in the x-function like:
levelcrossing iy:=col(2) level:=0 oy:=[??]!loose_a;
loose_a[1]=;

Edited by - Hideo Fujii on 02/19/2016 10:04:57 AM
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000