SAS simulation for derivation of arbitrary function

Source: Internet
Author: User

*The simulation derivation step must be smaller than the threshold value, in order to obtain the accurate result; Data derivation (keep=interval slope); * functionY= 1/X onlyConcern about X>0; DeltaX=1e-6;*the step that X1 decreases when the secant becomes tangent; X0= 2; Y0= 0;%function(y0,x0);*points to be required for guidance;    Put y0; Slope= 0;*the slope to be calculated, that is, the reciprocal; Interval= 5;*The distance between x0 and X1 in the x-axis is also the variable that determines the stop derivation; X1=X0+Interval Y1= 0;%function(Y1,X1);*The point at the other end of the secant, auxiliary derivative point; Thershold=1e-6 -1e-7;*the threshold for stopping the derivation; Do Until (interval<thershold); Interval=Interval-DeltaX;*update the spacing between x0 and X1; X1=X0+Interval%function(Y1,X1);*Update the coordinates of the X1; Slope=(y1-y0)/(x1-x0);*update slope, that is, countdown;    Output End; run;/*here is any function you need to ask for, SAS is using the updated policy, so you don't need to write the return value*/%Macrofunction(Y,X); &Y= 1 / &x;%Mend

SAS simulation for derivation of arbitrary function

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.