Clear Filters
Clear Filters

i have a problem ,

1 view (last 30 days)
mohammed elmenshawy
mohammed elmenshawy on 24 Dec 2016
Commented: Walter Roberson on 4 Jan 2017
A summary of what I want to do . i have function of 3 parameters L=f(x,y,z). i need differential this function with respect to x , y and z , and equality them by zero. Hence we get three equations in three parameters , Give initial values of the three parameters. In the first equation, which is where the differentiation for x we substitute only about y and z to get x value . By this logic with the y and z . what to do ?
  2 Comments
John BG
John BG on 24 Dec 2016
let the readers work on the equations by making them available here, either copy them or attach the MATLAB script with the equations.

Sign in to comment.

Answers (2)

Roger Stafford
Roger Stafford on 24 Dec 2016
If the derivatives of f with respect to x, to y, and to z are always zero, that means f must be a constant. Whatever the initial conditions for f(x,y,z), f must remains fixed at that initial condition.
  3 Comments
Roger Stafford
Roger Stafford on 24 Dec 2016
@Star. I interpreted his statement, “i need differential this function with respect to x , y and z , and equality them by zero” to mean “I need to differentiate this function with respect to x, y, and z, and to equate these derivatives all to zero”, which doesn’t sound like a problem in optimization.
Walter Roberson
Walter Roberson on 24 Dec 2016
I read it as wanting to solve for the point where the three partial derivatives are all zero.
However it is not necessarily a minimization since the partials would also all be zero at maxima or saddle points.

Sign in to comment.


John BG
John BG on 4 Jan 2017
1.
try function gradient on the function f(x,y,z) to obtain the 3D function to solve
note that gradients (AKA directional derivatives) vary according to the chosen coordinate systems:
2. to solve the gradient.
define the resulting function out of gradient with gradf(x,y,z) , in example:
function t1=fun1(x)
t1=exp(-x(1).^2-x(2).^2-x(3).^2)
and then
problem.objective=@fun1
problem.x0=[0 0 0]
problem.solver='fsolve'
problem.options = optimoptions('fsolve','Display','none','PlotFcn',@optimplotfirstorderopt);
fsolve(problem)
is it possible for you to supply along your question the function that you want to calculate the gradient and solve?
.
if you find these lines useful would you please mark my answer as Accepted Answer?
To any other reader, if you find this answer of any help please click on the thumbs-up vote link,
thanks in advance for time and attention
John BG
  1 Comment
Walter Roberson
Walter Roberson on 4 Jan 2017
The user is looking to create three equations: 1) the gradient of arbitrary function f with respect to x, in terms of only y and z; 2) the gradient of f with respect to y, in terms of only x and z; and 3) the gradient of f with respect to z, in terms of only x and y. The user then wants to solve those three equations simultaneously.
Unfortunately, in the general case, the gradient of a function with respect to a variable typically involves the variable as well.
A modification would be to take the gradient with respect to x, and solve that gradient equal to 0 with respect to x, and then to substitute that x into the gradient with respect to y. Then that gradient could be solved equal to 0 for the variable y. Then substitute the x found into the gradient with respect to z, and then substitute the y found into that, giving a gradient with respect to z that involves only the variable z; you can then equate that to 0 and solve for z. You can then back substitute to get y, and then back substitute the z then y to get x. There would generally be multiple solutions as the solutions would include all of the maxima, all of the minima, and all of the saddle points.
The procedure I describe is not what the user asked to do: the user expected the x to disappear automatically from the gradient with respect to x, and so on, leaving three equations in two variables each that could then be numerically solved for.

Sign in to comment.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!