5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
Introduction of calculus in programming
1. Introduction of calculus
in programming
Is it possible to write calculus function for c.
It would be very useful, I am sure it is possible because
there are math programs out there today
2. Use of calculus in programming
A program in a functional language is a set of function definitions and an
expression usually
formed using the defined functions. The Interpreter of the language evaluates this
expression by
means of a discrete number of computation steps, in such a way its meaning turns
out to be
represented in an explicit way. In general in programming we have not to produce
anything; in
functional programming, in particular, what we modify is only the representation
of the
information.
A function can be defined in several ways.
3. Example:
f: R -> R , g: R -> R
f '' - 6g' = 6 sin x
6g'' + a2 f ' = 6 cos x
f(0) = 0, f '(0) = 0, g(0) = 1, g'(0) = 1
This set of equations precisely identify two precise f and g.
4. To evaluate an expression in Scheme
the application of a function to some arguments and then to evaluate the body of the
function
in which the formal parameter is replaced by the actual parameter. In this way, in a
sense, we
make the meaning of such sub-expression more explicit.
5. Example: let us evaluate Inctwo 3
Inctwo 3 Inctwo is a user defined function, and it is applied to an argument, so we take
the
body of the function, replace the formal parameter n by the actual parameter 3,
obtaining
3+2, and then we evaluate 3+2 obtaining 5
6. evaluation strategy
a policy enabling to decide on which sub-expression we shall perform the next
evaluation step.
Some evaluation strategies could led me in a never ending path (this fact is
unavoidable)
7. Uses of calculus in
‘c++’ Language
#include<iostream.h>
Using name space std;
Int a,x,n,derivative;
Int main()
{
Cout<<”hellow.i am a computer program.I can calculate
the derivative of an expression using power rule.”;
Cout<<”n please type the values of a and n for use exp”;
Cout<<”n y=ax^n”;
Cin get();
Cout<<”a=?n”;
Cin>>a;
Cout<<”x=?,n=?n”
Cin>>x,n;
Derivative=a*n*(x^(n-1));
Cout<<”dy/dx=”<<derivative;
Return 0;
}