Numerical differentiation with change of variable

In summary, the conversation is about solving an integral with a derivative that has a change of variable inside. The speaker has a function for z(x) and knows the relation between x and θ, but is unsure how to evaluate the derivative numerically. The expert suggests using the value of x for a given θ to find dz/dθ and then using that to calculate dz/dx. The speaker eventually solves the problem using a piece of code in MATLAB.
  • #1
diegojolin
5
0
Hi all

I am trying to solve for an integral whose integrand is a derivative that has a change of variable inside of it.

∫ (dz/dx) * cos(θ) dθ between 0 and pi.

I have a function for z(x), and also know the relation between of x and θ, but what I don't know is how to evaluate such differential-integral operation numerically with the required change of variable.

x = c/2*(1-cos(θ) )

dz/dx = dz/dθ * dθ/dx... how can I evaluate that derivative NUMERICALLY in terms of θ ??

thanks in advance
 
Physics news on Phys.org
  • #2
What method are you using to evaluate dz/dx numerically in terms of x? I would suggest that you calculate the value of x for your given value of θ and find dz/dθ as (dz/dx)/(dθ/dx).
 
  • #3
I have finally solved it as I wanted to do it at the beginning, I still don't understand very much why this way is working and others i tried not, but so far i am happy with the results...

this is the piece of code that once run in MATLAB solved my problem

c = 1;
e = 1e-3;
Zc = @(x) -e.*x./c .* (x/c - 1);

N = 1e5;
xdom = linspace(0,c,N);
th = linspace(0,pi,N);

X= @(TH) c/2.*(1-cos(TH));
TH = @(X) acos(1 - 2*X/c);

Zth = Zc(X(th));

dzdth = diff(Zth) ./ diff(th);
dthdx = diff(TH(X(th))) ./ diff(X(th));
dzdx = dzdth.*dthdx;

I11 = trapz(th(2:N),dzdx)
I22 = trapz(th(2:N),dzdx.*cos(th(2:N))
 

FAQ: Numerical differentiation with change of variable

What is numerical differentiation?

Numerical differentiation is a method used to estimate the derivative of a function at a specific point by using a finite difference formula. It is an approximation technique used when the analytical expression for the derivative is not known.

What is change of variable in numerical differentiation?

Change of variable in numerical differentiation refers to the process of transforming the independent variable in a function to a different variable. This can make the calculation of the derivative easier or more accurate.

Why is change of variable used in numerical differentiation?

Change of variable is often used in numerical differentiation to improve the accuracy of the derivative estimation. It can also make the calculation simpler by reducing the complexity of the function.

What are the common methods of numerical differentiation with change of variable?

The most commonly used methods of numerical differentiation with change of variable are the forward difference method, backward difference method, and central difference method. These methods use different approaches to estimate the derivative based on the change of variable.

How do I choose the appropriate method for numerical differentiation with change of variable?

The choice of method for numerical differentiation with change of variable depends on the type of function and the level of accuracy required. The central difference method is often preferred for its balance of accuracy and simplicity, but the other methods may be more suitable for certain functions.

Similar threads

Replies
4
Views
2K
Replies
4
Views
1K
Replies
29
Views
2K
Replies
6
Views
1K
Replies
8
Views
1K
Replies
1
Views
1K
Replies
9
Views
2K
Replies
4
Views
1K
Back
Top