Author |
Topic  |
|
Rimmer
Sweden
25 Posts |
Posted - 06/25/2002 : 4:38:21 PM
|
I've tried the differentiation example on page 129 of the programming guide. However, the results are not placed in the two columns that were created. The code compiles fine, but all I get is blanks in "DerivX" and "-" in "DerivY".
Does anyone have any clues what might be wrong.
Origin 7 Pro, windows XP.
Michael |
|
cpyang
USA
1406 Posts |
Posted - 06/25/2002 : 11:41:51 PM
|
The example can be changed as follows
void test(string wksName, int colX, int colY) { Worksheet wks(wksName); Curve cc1(wks, colX, colY); int newColX = wks.AddCol("DerivX"); int newColY = wks.AddCol("DerivY"); wks.Columns(newColX).SetType(OKDATAOBJ_DESIGNATION_X); // need to fill result Curve X and set Y size Dataset newX(wks,newColX); Dataset oldX(wks,colX); newX = oldX; Curve cc2(wks, newColX, newColY); cc2=newX; // to force newColY to be the right size // Curve_derivative(&cc1, &cc2, 1); }
We will need to fix the Curve_derivative function in our upcoming service release so that you don't have to set the size on the result curve. But for the time being, you will have to SetSize before a function can put values into a dataset.
CP
|
 |
|
Rimmer
Sweden
25 Posts |
Posted - 06/26/2002 : 03:19:48 AM
|
Thank you for the help. On a similar note, I was wondering which method of differentation that is used. I've read that there is a method by Proctor and Sherwood that is meant to be good. Any plans on implementing this. Otherwise does anyone have any code written that uses their technique.
-- Michael |
 |
|
Rimmer
Sweden
25 Posts |
Posted - 06/26/2002 : 04:07:36 AM
|
I've tried the new code listed above, and it works. However, It seem that the fiff routine does something strange. I tested it by filling A(x)=i and B(Y)=10i+5i^2+3i^3+6i^4, and then differentiating a number of times. The results after the diff stafe become more and more garbled and are far from the expected values.
--Michael |
 |
|
easwar
USA
1965 Posts |
Posted - 06/26/2002 : 10:36:12 AM
|
Hi,
We tried your starting formula and computed derivatives by differentiating the formula and setting column values (lines in the graph), and also using the code posted here (symbols in the graph). Though the values deviate for low i, the results are close to the theoretical values.
We use the NAG library to perform the derivatives - the functions called are nag_1d_spline_fit, nag_1d_spline_deriv. We will work on adding more documentation to how we use these functions in our curve_derivative call. For now you could look at the documentation on these NAG functions in our help files.
[img]http://www.originlab.com/ftp/forum_and_kbase/images/diff.jpg" alt="balloon help">
Easwar OriginLab
Edited by - easwar on 06/26/2002 10:36:42 |
 |
|
easwar
USA
1965 Posts |
Posted - 06/26/2002 : 10:37:16 AM
|
Hi,
We tried your starting formula and computed derivatives by differentiating the formula and setting column values (lines in the graph), and also using the code posted here (symbols in the graph). Though the values deviate for low i, the results are close to the theoretical values.
We use the NAG library to perform the derivatives - the functions called are nag_1d_spline_fit, nag_1d_spline_deriv. We will work on adding more documentation to how we use these functions in our curve_derivative call. For now you could look at the documentation on these NAG functions in our help files.
Easwar OriginLab
Edited by - easwar on 06/26/2002 10:37:49 |
 |
|
NRLchamp
USA
Posts |
Posted - 03/23/2006 : 2:07:04 PM
|
I've tried the code suggested on this page (I cut and pasted it directly), but it appears as Curve_derivative isn't executing. Apparently everything up to that point works, I say this because my two derivative columns (X and Y) get filled by the original X values as a result of their assignments to oldX and newX, respectively; but after the code is executed, the Y derivative column is unchanged and still holding the original X values. Any suggestions? |
 |
|
Mike Buess
USA
3037 Posts |
Posted - 03/23/2006 : 2:54:58 PM
|
Remember that OriginC column/row indices start with zero. To apply the test() function to the first two columns of the active worksheet from the script window use test %H 0 1. (I suspect you used test %H 1 2.)
Mike Buess Origin WebRing Member
Edited by - Mike Buess on 03/23/2006 2:57:38 PM |
 |
|
NRLchamp
USA
Posts |
Posted - 03/23/2006 : 5:36:29 PM
|
Nope, I entered it correctly. It's really weird, because another user on another computer can do it without difficulty, but for some reason my computer won't.
|
 |
|
Mike Buess
USA
3037 Posts |
Posted - 03/23/2006 : 5:43:30 PM
|
Do both computers have the same Origin build?
Mike Buess Origin WebRing Member |
 |
|
|
Topic  |
|