How to design mathematical program which calculate the derivative of a function using python?
Date : March 29 2020, 07:55 AM
Does that help If I want to create a program which calculate the derivative of functions. , Taking a function is easy... it's just like any other argument. def example(somefunc):
somefunc()
example(someFunction)
example(lambda x: x ** 2)
def example2():
return lambda x: x + 1
def example3():
def rf(x):
return x + 2
return rf
myfunc = example3()
myfunc(2) #returns 4

How do I get the nth derivative in my scheme program?
Date : March 29 2020, 07:55 AM
With these it helps Your h of .00000000000001 is too small; so small that you are running into rounding errors. Here is a result with another h (define derofcuben (dern cube 0.0001 2))
> (derofcuben 5)
30.000597917023697
> (define derofcuben (dern cube (/ 10000000000000) 2))
> (derofcuben 5)
150000000000003/5000000000000
> (rationalize (derofcuben 5) 0.01)
3e1

Program that finds y, derivative, and integral vals of a polynomial (UPDATED)
Tag : c , By : Marcos de Carvalho
Date : March 29 2020, 07:55 AM
hop of those help? I saw some problem with your code: 1> Your derivation function is not correct. should be 2*a*x + b #include <stdio.h>
#include <stdlib.h>
#include <math.h>
void explain();
void math(double a, double b, double c, double x, double xi, double *fx, double *fD, double *A);
int main()
{
double a, b, c;
double xi, xf, xc, x = 0;
double fx = 0, fD = 0, A = 0;
printf("SECOND DEGREE POLYNOMIAL CALCULATOR\n\n");
explain();
printf("\n\nEnter a value for a: ");
scanf("%lg", &a);
printf("Enter a value for b: ");
scanf("%lg", &b);
printf("Enter a value for c: ");
scanf("%lg", &c);
printf("\nYour function is %lgx^2%+lgx%+lg", a, b, c);
printf("\n\nEnter your initial xvalue: ");
scanf("%lg", &xi);
printf("Enter your final xvalue: ");
scanf("%lg", &xf);
printf("Enter what you would like to increment by: ");
scanf("%lg", &xc);
printf(" x  f(x)  f'(x)  A \n"); //printing table
printf("\n");
x = xi;
double nextX;
while (x <= xf) {
nextX = x + xc;
math(a, b, c, x, nextX, &fx, &fD, &A);
printf(" %.3lf  %.3lf  %.3lf  %.3lf \n", x, fx, fD, A);
x = x + xc;
}
return 0;
}
void explain() {
printf("This program computes the integral and derivative of a user inputted seconddegree polynomial (f(x)=ax^2+bx+c).\n");
printf("You will be asked to enter the 3 coefficients of your polynomial, followed by your initial xvalue, your\n");
printf("final xvalue, and the increment value between each x.");
}
void math(double a, double b, double c, double x, double xi, double *fx, double *fD, double *A) {
*fx = (a*(x*x)) + (b*x) + c; //finding y values
*fD = (2 * a * x) + b; //finding derivative values
*A = ((a / 3)*pow(x, 3) + (a / 2)*pow(x, 2) + c * x)  ((a / 3)*pow(xi, 3) + (a / 2)*pow(xi, 2) + c * xi); //finding integral values
return;
}

Derivative of function of vectorfunctions based on derivative of vectors in sympy
Tag : python , By : Matt Croydon
Date : March 29 2020, 07:55 AM
seems to work fine I want to calculate the derivative of a function of vectorfunctions based on derivative of vectors in Python using sympy. For example, if the function is: , The derivative can be calculated with >>> from sympy.abc import t
>>> g = Function('g', commutative=False)
>>> gT = Function('gT', commutative=False)
>>> f = g(t) / sqrt(gT(t) * g(t))
>>> f.diff(t).simplify()
(g(t)*(gT(t)*g(t))**(1/2)*(gT(t)*Derivative(g(t), t) + Derivative(gT(t), t)*g(t))*(gT(t)*g(t))**(1) + 2*Derivative(g(t), t)*(gT(t)*g(t))**(1/2))/2

hello, I am trying to write a simple program in python that will calculate the derivative of a polynomial function
Tag : python , By : Amin Amini
Date : March 29 2020, 07:55 AM

