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
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 math in worksheet

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
kychung72 Posted - 01/10/2007 : 12:35:26 AM
Origin Version (Select Help-->About Origin): OriginPro 7.5 SR6
Operating System: XP

Hi all,

I wrote a code below;

test(string wksname, double variable)
{
string original, target;
original=wksname+"_A";
target=wksname+"_B";
Dataset dsOriginal(original), dsTarget(target);
dsTarget=2*180/pi*asin(sin(0.5*pi/180*dsOriginal)*1.540562/variable);
}

The purpose of the code is to do a simple math on col(A) and fill the col(B) with the results. The "variable" ranges between 0.5 to 1.5. The col(A) is filled with the numbers ranging between -5~100.
But the funny thing is that the code fills the 1st row of the col(B) with the calculated result and fills other rows with "0". This happens only in the very first time of its execution after the Origin is launched. Once the code is executed malfunctionally, the code works fine afterwards.
Could anyone give me a comment or suggestion?
Thanks.
2   L A T E S T    R E P L I E S    (Newest First)
kychung72 Posted - 01/11/2007 : 01:08:50 AM
Thanks Zachary.
It works!

I hope you could fix the bug and release the update.
zachary_origin Posted - 01/10/2007 : 02:20:27 AM
Hi,

There is a known bug for calculating the datasets multiplying double numbers. A workaround is changing
dsTarget=2*180/pi*asin(sin(0.5*pi/180*dsOriginal)*1.540562/variable);
to
dsTarget=asin(sin(0.5*pi/180*dsOriginal)*1.540562/variable)*2*180/pi;

Similar problem is met by another usr in the forum
http://www.originlab.com/forum/topic.asp?TOPIC_ID=5215

Zachary
OriginLab Technical Services.

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000