Open rtoy opened 3 months ago
Imported from SourceForge on 2024-07-07 20:55:31 Created by ncwerons on 2019-05-13 13:40:07 Original: https://sourceforge.net/p/maxima/bugs/3553/#a326
Let me just make an important correction. What I wrote in my previous message, is not generally correct, sorry. The derivatives I described above should be equal only at x = 0. So, let me write it again in the correct form: From analytical considerations I know that, for 0 < y < %pi, the first derivative of f0(x, y) with respect to x, at x = 0, is equal to the function g0(x, y) at x = 0. You can double check it making a plot of the difference between diff(f0(x, y), x) and g0(x, y) at x = 0. Consequently, n-th derivative of f0(x, y) with respect to x, at x = 0, should be equal to (n-1)-th derivative of g0(x, y) with respect to x, at x = 0. The rest of my previous message should be fine.
Imported from SourceForge on 2024-07-07 20:55:34 Created by robert_dodier on 2019-06-10 00:28:50 Original: https://sourceforge.net/p/maxima/bugs/3553/#5371
By the way, note that I have omitted all calls to simplification functions. radcan
and trigsimp
have the potential to apply non-invertible transformations, so I think it could make the results more difficult to figure out what's going on if those calls are present. In any event, it appears that the difference in the derivatives appears even though simplification functions are not called.
Imported from SourceForge on 2024-07-07 20:55:38 Created by ncwerons on 2019-06-10 07:55:04 Original: https://sourceforge.net/p/maxima/bugs/3553/#e71e/a69e
Robert,
Thanks a lot for keeping me updated.
So, it seems that maxima works fine. There is a math problem that I have overlooked. Let me think again about the functions.
Pawel
On 6/10/19 2:26 AM, Robert Dodier wrote:
Pawel, I have been looking and looking at this and I can't figure out what's going on.
When I compare the computed derivatives of |f| with finite difference approximations, it appears that the k'th derivative agrees with a finite difference approximation of the derivative of the (k - 1)'th computed derivative (i.e. compute the derivatives one degree at a time, and compare to finite difference applied to previous computed derivative).
Same with |g|, computed derivatives agree with finite difference approximations.
Computing higher degree finite differences and comparing the k'th f.d. approximation for |f| to the (k - 1)'th f.d. approximation of |g|, it appears that for k = 1, 2, 3, the approximations for |f| and |g| agree, and for k = 4, the approximations disagree, in what appears to be the same way in which |g30| disagrees with |f40|. Note that in this comparison, no derivatives are computed by Maxima |diff|.
I'm really puzzled by that behavior. I wonder if it would help to look at |f| and |g| term by term and see if there is some basic term which is being handled incorrectly. Just thinking out loud here.
Here is my script that I was working with:
s(x, y) := sqrt(1 + (1 + x) ^ 2 - 2 (1 + x) cos(y));
f0: acos(s(x, y) / 2) - s(x, y) sqrt(4 - s(x, y) ^ 2) / 4 + sin(y) x / 2;
f1: diff (f0, x); f2: diff (f1, x); f3: diff (f2, x); f4: diff (f3, x);
f10: subst (x = 0, f1); f20: subst (x = 0, f2); f30: subst (x = 0, f3); f40: subst (x = 0, f4);
g0: acos((1 + x - cos(y)) / s(x, y)) - acos(s(x, y) / 2);
g1: diff (g0, x); g2: diff (g1, x); g3: diff (g2, x);
g00: subst (x = 0, g0); g10: subst (x = 0, g1); g20: subst (x = 0, g2); g30: subst (x = 0, g3);
plot2d (g00 - f10, [y, -10, 10], [y, -10, 10]); / zero on (0, %pi) / plot2d (g10 - f20, [y, -10, 10], [y, -10, 10]); / zero everywhere / plot2d (g20 - f30, [y, -10, 10], [y, -10, 10]); / zero everywhere w/ artifact at %pi / plot2d (g30 - f40, [y, -10, 10], [y, -10, 10]); / nonzero everywhere /
finite_diff1_at_x_eq_0 (e) := block ([dx: 1/1000000], (subst (x = +dx/2, e) - subst (x = -dx/2, e))/dx);
plot2d ([f10, finite_diff1_at_x_eq_0 (f0)], [y, -10, 10], [y, -10, 10]); / same / plot2d ([f20, finite_diff1_at_x_eq_0 (f1)], [y, -10, 10], [y, -10, 10]); / same / plot2d ([f30, finite_diff1_at_x_eq_0 (f2)], [y, -10, 10], [y, -10, 10]); / same / plot2d ([f40, finite_diff1_at_x_eq_0 (f3)], [y, -10, 10], [y, -10, 10]); / same /
plot2d ([g10, finite_diff1_at_x_eq_0 (g0)], [y, -10, 10], [y, -10, 10]); / same / plot2d ([g20, finite_diff1_at_x_eq_0 (g1)], [y, -10, 10], [y, -10, 10]); / same / plot2d ([g30, finite_diff1_at_x_eq_0 (g2)], [y, -10, 10], [y, -10, 10]); / same /
plot2d ([finite_diff1_at_x_eq_0 (f0), g00], [y, -10, 10], [y, -10, 10]); / same on (0, %pi) / plot2d ([finite_diff1_at_x_eq_0 (f1), g10], [y, -10, 10], [y, -10, 10]); / same everywhere / plot2d ([finite_diff1_at_x_eq_0 (f2), g20], [y, -10, 10], [y, -10, 10]); / same everywhere / plot2d ([finite_diff1_at_x_eq_0 (f3), g30], [y, -10, 10], [y, -10, 10]); / different /
/* coefficients for second and higher differences from:
finite_diff2_at_x_eq_0 (e) := block ([dx: 1/1000], (subst (x = +dx, e) - 2*subst (x = 0, e) + subst (x = -dx, e))/(dx^2));
finite_diff3_at_x_eq_0 (e) := block ([dx: 1/100], subst(x = (3dx)/2,e)-3subst(x = dx/2,e)+3subst(x = -dx/2,e) -subst(x = -(3dx)/2,e), %%/dx^3)$
finite_diff4_at_x_eq_0 (e) := block ([dx: 1/100], subst(x = 2dx,e)-4subst(x = dx,e)-4subst(x = -dx,e)+subst(x = -2dx,e) +6*subst(x = 0,e), %%/dx^4)$
plot2d ([finite_diff1_at_x_eq_0 (f0), g00], [y, -10, 10], [y, -10, 10]); / same on (0, %pi) / plot2d ([finite_diff2_at_x_eq_0 (f0), finite_diff_at_x_eq_0 (g0)], [y, -10, 10], [y, -10, 10]); / same everywhere / plot2d ([finite_diff3_at_x_eq_0 (f0), finite_diff2_at_x_eq_0 (g0)], [y, -10, 10], [y, -10, 10]); / same everywhere / plot2d ([finite_diff4_at_x_eq_0 (f0), finite_diff3_at_x_eq_0 (g0)], [y, -10, 10], [y, -10, 10]); / different /
[bugs:#3553] https://sourceforge.net/p/maxima/bugs/3553/ Erroneous fourth derivative
Status: open Group: None Created: Mon May 13, 2019 08:50 AM UTC by Pawel Weronski Last Updated: Sun Jun 09, 2019 09:44 PM UTC Owner: nobody
Hi, I have analyzed two functions of two variables x and y:
f0(x, y) = acos(s(x, y) / 2) - s(x, y) sqrt(4 - s(x, y) ^ 2) / 4 + sin(y) x / 2
and
g0(x, y) = acos((1 + x - cos(y)) / s(x, y)) - acos(s(x, y) / 2),
where
s(x, y) = sqrt(1 + (1 + x) ^ 2 - 2 (1 + x) cos(y)).
From analytical considerations I know that, for 0 < y < %pi, the first derivative of f0(x, y) with respect to x is equal to the function g0(x, y). You can double check it making a plot of the difference between diff(f0(x, y), x) and g0(x, y). Consequently, n-th derivative of f0(x, y) with respect to x should be equal to (n-1)-th derivative of g0(x, y) with respect to x. Indeed, for n < 4 it is the case. However, for n = 4 the derivatives are different. Below I have provided two short maxima cells demonstrating that. For the sake of simplicity, I have calculated the derivatives at x = 0. For n = 4 the derivatives are different by the term |cot(y)^3 / 3|, as you can find by making some algebra on the final results.
Here is the first cell for calculating derivatives of the function f0(x, y):
/ [wxMaxima: input start ] / kill(all);
/ First, define the auxiliary function s(x, y) / s(x,y):=sqrt(1+(1+x)^2-2(1+x)cos(y));
/ Then, define the function f0(x, y) /
f0(x,y):=acos(s(x,y)/2)-s(x,y)sqrt(4-s(x,y)^2)/4+sin(y)x/2;
/ Then, calculate the first derivative of the function f0(x, y) and its value at x = 0 /
f1(x,y):=ratsimp(diff(f0(x,y),x)); f1(x,y); f10(y):=factor(ratsimp(at(f1(x,y),x=0))); f10(y);
/ Next, calculate the second derivative of the function f0(x, y) and its value at x = 0 /
f2(x,y):=diff(f1(x,y),x); f20(y):=factor(ratsimp(at(f2(x,y),x=0))); f20(y);
/ Then, calculate the third derivative of the function f0(x, y) and its value at x = 0 /
f3(x,y):=diff(f2(x,y),x); f30(y):=factor(ratsimp(at(f3(x,y),x=0))); f30(y);
/ Next, calculate the fourth derivative of the function f0(x, y) and its value at x = 0 /
f4(x,y):=diff(f3(x,y),x); f40(y):=factor(ratsimp(at(f4(x,y),x=0))); f40(y); / [wxMaxima: input end ] /
And here is the second cell for calculating derivatives of the function g0(x, y):
/ [wxMaxima: input start ] / kill(all);
/ First, define the auxiliary function s(x, y) /
s(x,y):=sqrt(1+(1+x)^2-2(1+x)cos(y));
/ Then, define the function g0(x, y) and calculate its value at x = 0 /
g0(x,y):=acos((1+x-cos(y))/s(x,y))-acos(s(x,y)/2); g00(y):=at(g0(x,y),x=0); g00(y);
/ Next, calculate the first derivative of the function g0(x, y) and its value at x = 0 /
g1(x,y):=diff(g0(x,y),x); g10(y):=radcan(factor(trigsimp(ratsimp((at(g1(x,y),x=0))))))$ g10(y);
/ Then, calculate the second derivative of the function g0(x, y) and its value at x = 0 /
g2(x,y):=diff(g1(x,y),x); g20(y):=radcan(factor(trigsimp(ratsimp((at(g2(x,y),x=0))))))$ g20(y);
/ Next, calculate the first derivative of the function g0(x, y) and its value at x = 0 /
g3(x,y):=diff(g2(x,y),x); g30(y):=radcan(factor(trigsimp(ratsimp((at(g3(x,y),x=0))))))$ g30(y); / [wxMaxima: input end ] /
Is it a bug, or am I making something wrong?
build_info(version="5.37.2",timestamp="2015-10-30 02:08:33",host="x86_64-unknown-linux-gnu",lisp_name="GNU Common Lisp (GCL)",lisp_version="GCL 2.6.12")
Best, Pawel
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/maxima/bugs/3553/
To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/
Attachments:
Imported from SourceForge on 2024-07-07 20:55:42 Created by ncwerons on 2019-06-10 10:06:01 Original: https://sourceforge.net/p/maxima/bugs/3553/#e71e/a69e/c93a
OK, I think I found the reason of that "strange" behavior.
The problem is that we compare functions of y, which we get by differentiation of functions of x and y with respect to x, at a specific value of x. It is easy to show that such derivatives can be identical up to the order n and different at higher orders n + k, where k is a natural number. Here is an example.
Let p0(x, y) be equal:
p0(x, y) = a4 x^4 y + x^3 y^2 + x^2 y^3 + x y^4 + 1,
where a4 is a real number. Then, the derivatives of p0(x, y) with respect to x are:
p1(x, y) = 4 a4 x^3 y + 3 x^2 y^2 + 2 x y^3 + y^4, p2(x, y) = 12 a4 x^2 y + 6 x y^2 + 2 y^3, p3(x, y) = 24 a4 x y + 6 y^2, p4(y) = 24 a4 y.
Let q0(x, y) be equal:
q0(x, y) = b3 x^3 y + 3 x^2 y^2 + 2 x y^3 + y^4,
where b3 is a real number. Then, the derivatives of q0(x, y) with respect to x are:
q1(x, y) = 3 b3 x^2 y + 6 x y^2 + 2 y^3, q2(x, y) = 6 b3 x y + 6 y^2, q3(y) = 6 b3 y.
At x = 0, we have:
p10(y) = y^4, p20(y) = 2 y^3, p30(y) = 6 y^2, p40(y) = 24 a4 y,
and
q00(y) = y^4, q10(y) = 2 y^3, q20(y) = 6 y^2, q30(y) = 6 b3 y.
Thus, p10(y) = q00(y), p20(y) = q10(y), p30(y) = q20(y). But, in general, p40(y) and q30(y) are different, except the special case when b3 = 4 a4.
So, the functions f0(x, y) and g0(x, y) that I have analyzed can behave like that. Most likely they have simply different derivatives with respect to x, at x = 0, starting from the order four and three, respectively. At the first look it may seem somewhat surprising, but at a closer inspection it appears to be quite possible.
Sorry for bothering you and thanks a lot for your help,
Pawel
On 6/10/19 9:55 AM, Pawel Weronski wrote:
Robert,
Thanks a lot for keeping me updated.
So, it seems that maxima works fine. There is a math problem that I have overlooked. Let me think again about the functions.
Pawel
On 6/10/19 2:26 AM, Robert Dodier wrote:
Pawel, I have been looking and looking at this and I can't figure out what's going on. When I compare the computed derivatives of |f| with finite difference approximations, it appears that the k'th derivative agrees with a finite difference approximation of the derivative of the (k - 1)'th computed derivative (i.e. compute the derivatives one degree at a time, and compare to finite difference applied to previous computed derivative). Same with |g|, computed derivatives agree with finite difference approximations. Computing higher degree finite differences and comparing the k'th f.d. approximation for |f| to the (k - 1)'th f.d. approximation of |g|, it appears that for k = 1, 2, 3, the approximations for |f| and |g| agree, and for k = 4, the approximations disagree, in what appears to be the same way in which |g30| disagrees with |f40|. Note that in this comparison, no derivatives are computed by Maxima |diff|. I'm really puzzled by that behavior. I wonder if it would help to look at |f| and |g| term by term and see if there is some basic term which is being handled incorrectly. Just thinking out loud here. Here is my script that I was working with: s(x, y) := sqrt(1 + (1 + x) ^ 2 - 2 * (1 + x) * cos(y)); f0: acos(s(x, y) / 2) - s(x, y) * sqrt(4 - s(x, y) ^ 2) / 4 + sin(y) * x / 2; f1: diff (f0, x); f2: diff (f1, x); f3: diff (f2, x); f4: diff (f3, x); f10: subst (x = 0, f1); f20: subst (x = 0, f2); f30: subst (x = 0, f3); f40: subst (x = 0, f4); g0: acos((1 + x - cos(y)) / s(x, y)) - acos(s(x, y) / 2); g1: diff (g0, x); g2: diff (g1, x); g3: diff (g2, x); g00: subst (x = 0, g0); g10: subst (x = 0, g1); g20: subst (x = 0, g2); g30: subst (x = 0, g3); plot2d (g00 - f10, [y, -10, 10], [y, -10, 10]); //zero on (0, %pi) // plot2d (g10 - f20, [y, -10, 10], [y, -10, 10]); //zero everywhere // plot2d (g20 - f30, [y, -10, 10], [y, -10, 10]); //zero everywhere w/ artifact at %pi // plot2d (g30 - f40, [y, -10, 10], [y, -10, 10]); //nonzero everywhere // finite_diff1_at_x_eq_0 (e) := block ([dx: 1/1000000], (subst (x = +dx/2, e) - subst (x = -dx/2, e))/dx); plot2d ([f10, finite_diff1_at_x_eq_0 (f0)], [y, -10, 10], [y, -10, 10]); //same // plot2d ([f20, finite_diff1_at_x_eq_0 (f1)], [y, -10, 10], [y, -10, 10]); //same // plot2d ([f30, finite_diff1_at_x_eq_0 (f2)], [y, -10, 10], [y, -10, 10]); //same // plot2d ([f40, finite_diff1_at_x_eq_0 (f3)], [y, -10, 10], [y, -10, 10]); //same // plot2d ([g10, finite_diff1_at_x_eq_0 (g0)], [y, -10, 10], [y, -10, 10]); //same // plot2d ([g20, finite_diff1_at_x_eq_0 (g1)], [y, -10, 10], [y, -10, 10]); //same // plot2d ([g30, finite_diff1_at_x_eq_0 (g2)], [y, -10, 10], [y, -10, 10]); //same // plot2d ([finite_diff1_at_x_eq_0 (f0), g00], [y, -10, 10], [y, -10, 10]); //same on (0, %pi) // plot2d ([finite_diff1_at_x_eq_0 (f1), g10], [y, -10, 10], [y, -10, 10]); //same everywhere // plot2d ([finite_diff1_at_x_eq_0 (f2), g20], [y, -10, 10], [y, -10, 10]); //same everywhere // plot2d ([finite_diff1_at_x_eq_0 (f3), g30], [y, -10, 10], [y, -10, 10]); //different // //coefficients for second and higher differences from: / https://en.wikipedia.org/wiki/Finite_difference */ finite_diff2_at_x_eq_0 (e) := block ([dx: 1/1000], (subst (x = +dx, e) - 2*subst (x = 0, e) + subst (x = -dx, e))/(dx^2)); finite_diff3_at_x_eq_0 (e) := block ([dx: 1/100], subst(x = (3/dx)/2,e)-3/subst(x = dx/2,e)+3/subst(x = -dx/2,e) -subst(x = -(3/dx)/2,e), %%/dx^3)$ finite_diff4_at_x_eq_0 (e) := block ([dx: 1/100], subst(x = 2/dx,e)-4/subst(x = dx,e)-4/subst(x = -dx,e)+subst(x = -2/dx,e) +6*subst(x = 0,e), %%/dx^4)$ plot2d ([finite_diff1_at_x_eq_0 (f0), g00], [y, -10, 10], [y, -10, 10]); //same on (0, %pi) // plot2d ([finite_diff2_at_x_eq_0 (f0), finite_diff_at_x_eq_0 (g0)], [y, -10, 10], [y, -10, 10]); //same everywhere // plot2d ([finite_diff3_at_x_eq_0 (f0), finite_diff2_at_x_eq_0 (g0)], [y, -10, 10], [y, -10, 10]); //same everywhere // plot2d ([finite_diff4_at_x_eq_0 (f0), finite_diff3_at_x_eq_0 (g0)], [y, -10, 10], [y, -10, 10]); //different // ------------------------------------------------------------------------ /[bugs:#3553] <https://sourceforge.net/p/maxima/bugs/3553/> https://sourceforge.net/p/maxima/bugs/3553/ Erroneous fourth derivative/ /Status:/ open /Group:/ None /Created:/ Mon May 13, 2019 08:50 AM UTC by Pawel Weronski /Last Updated:/ Sun Jun 09, 2019 09:44 PM UTC /Owner:/ nobody Hi, I have analyzed two functions of two variables x and y: f0(x, y) = acos(s(x, y) / 2) - s(x, y) * sqrt(4 - s(x, y) ^ 2) / 4 + sin(y) * x / 2 and g0(x, y) = acos((1 + x - cos(y)) / s(x, y)) - acos(s(x, y) / 2), where s(x, y) = sqrt(1 + (1 + x) ^ 2 - 2 * (1 + x) * cos(y)). From analytical considerations I know that, for 0 < y < %pi, the first derivative of f0(x, y) with respect to x is equal to the function g0(x, y). You can double check it making a plot of the difference between diff(f0(x, y), x) and g0(x, y). Consequently, n-th derivative of f0(x, y) with respect to x should be equal to (n-1)-th derivative of g0(x, y) with respect to x. Indeed, for n < 4 it is the case. However, for n = 4 the derivatives are different. Below I have provided two short maxima cells demonstrating that. For the sake of simplicity, I have calculated the derivatives at x = 0. For n = 4 the derivatives are different by the term |cot(y)^3 / 3|, as you can find by making some algebra on the final results. Here is the first cell for calculating derivatives of the function f0(x, y): //[wxMaxima: input start ] // kill(all); //First, define the auxiliary function s(x, y) // s(x,y):=sqrt(1+(1+x)^2-2/(1+x)/cos(y)); //Then, define the function f0(x, y) // f0(x,y):=acos(s(x,y)/2)-s(x,y)/sqrt(4-s(x,y)^2)/4+sin(y)/x/2; //Then, calculate the first derivative of the function f0(x, y) and its value at x = 0 // f1(x,y):=ratsimp(diff(f0(x,y),x)); f1(x,y); f10(y):=factor(ratsimp(at(f1(x,y),x=0))); f10(y); //Next, calculate the second derivative of the function f0(x, y) and its value at x = 0 // f2(x,y):=diff(f1(x,y),x); f20(y):=factor(ratsimp(at(f2(x,y),x=0))); f20(y); //Then, calculate the third derivative of the function f0(x, y) and its value at x = 0 // f3(x,y):=diff(f2(x,y),x); f30(y):=factor(ratsimp(at(f3(x,y),x=0))); f30(y); //Next, calculate the fourth derivative of the function f0(x, y) and its value at x = 0 // f4(x,y):=diff(f3(x,y),x); f40(y):=factor(ratsimp(at(f4(x,y),x=0))); f40(y); //[wxMaxima: input end ] // And here is the second cell for calculating derivatives of the function g0(x, y): //[wxMaxima: input start ] // kill(all); //First, define the auxiliary function s(x, y) // s(x,y):=sqrt(1+(1+x)^2-2/(1+x)/cos(y)); //Then, define the function g0(x, y) and calculate its value at x = 0 // g0(x,y):=acos((1+x-cos(y))/s(x,y))-acos(s(x,y)/2); g00(y):=at(g0(x,y),x=0); g00(y); //Next, calculate the first derivative of the function g0(x, y) and its value at x = 0 // g1(x,y):=diff(g0(x,y),x); g10(y):=radcan(factor(trigsimp(ratsimp((at(g1(x,y),x=0))))))$ g10(y); //Then, calculate the second derivative of the function g0(x, y) and its value at x = 0 // g2(x,y):=diff(g1(x,y),x); g20(y):=radcan(factor(trigsimp(ratsimp((at(g2(x,y),x=0))))))$ g20(y); //Next, calculate the first derivative of the function g0(x, y) and its value at x = 0 // g3(x,y):=diff(g2(x,y),x); g30(y):=radcan(factor(trigsimp(ratsimp((at(g3(x,y),x=0))))))$ g30(y); //[wxMaxima: input end ] // Is it a bug, or am I making something wrong? build_info(version="5.37.2",timestamp="2015-10-30 02:08:33",host="x86_64-unknown-linux-gnu",lisp_name="GNU Common Lisp (GCL)",lisp_version="GCL 2.6.12") Best, Pawel ------------------------------------------------------------------------ Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/maxima/bugs/3553/ To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/
[bugs:#3553] https://sourceforge.net/p/maxima/bugs/3553/ Erroneous fourth derivative
Status: open Group: None Created: Mon May 13, 2019 08:50 AM UTC by Pawel Weronski Last Updated: Mon Jun 10, 2019 12:28 AM UTC Owner: nobody
Hi, I have analyzed two functions of two variables x and y:
f0(x, y) = acos(s(x, y) / 2) - s(x, y) sqrt(4 - s(x, y) ^ 2) / 4 + sin(y) x / 2
and
g0(x, y) = acos((1 + x - cos(y)) / s(x, y)) - acos(s(x, y) / 2),
where
s(x, y) = sqrt(1 + (1 + x) ^ 2 - 2 (1 + x) cos(y)).
From analytical considerations I know that, for 0 < y < %pi, the first derivative of f0(x, y) with respect to x is equal to the function g0(x, y). You can double check it making a plot of the difference between diff(f0(x, y), x) and g0(x, y). Consequently, n-th derivative of f0(x, y) with respect to x should be equal to (n-1)-th derivative of g0(x, y) with respect to x. Indeed, for n < 4 it is the case. However, for n = 4 the derivatives are different. Below I have provided two short maxima cells demonstrating that. For the sake of simplicity, I have calculated the derivatives at x = 0. For n = 4 the derivatives are different by the term |cot(y)^3 / 3|, as you can find by making some algebra on the final results.
Here is the first cell for calculating derivatives of the function f0(x, y):
/ [wxMaxima: input start ] / kill(all);
/ First, define the auxiliary function s(x, y) / s(x,y):=sqrt(1+(1+x)^2-2(1+x)cos(y));
/ Then, define the function f0(x, y) /
f0(x,y):=acos(s(x,y)/2)-s(x,y)sqrt(4-s(x,y)^2)/4+sin(y)x/2;
/ Then, calculate the first derivative of the function f0(x, y) and its value at x = 0 /
f1(x,y):=ratsimp(diff(f0(x,y),x)); f1(x,y); f10(y):=factor(ratsimp(at(f1(x,y),x=0))); f10(y);
/ Next, calculate the second derivative of the function f0(x, y) and its value at x = 0 /
f2(x,y):=diff(f1(x,y),x); f20(y):=factor(ratsimp(at(f2(x,y),x=0))); f20(y);
/ Then, calculate the third derivative of the function f0(x, y) and its value at x = 0 /
f3(x,y):=diff(f2(x,y),x); f30(y):=factor(ratsimp(at(f3(x,y),x=0))); f30(y);
/ Next, calculate the fourth derivative of the function f0(x, y) and its value at x = 0 /
f4(x,y):=diff(f3(x,y),x); f40(y):=factor(ratsimp(at(f4(x,y),x=0))); f40(y); / [wxMaxima: input end ] /
And here is the second cell for calculating derivatives of the function g0(x, y):
/ [wxMaxima: input start ] / kill(all);
/ First, define the auxiliary function s(x, y) /
s(x,y):=sqrt(1+(1+x)^2-2(1+x)cos(y));
/ Then, define the function g0(x, y) and calculate its value at x = 0 /
g0(x,y):=acos((1+x-cos(y))/s(x,y))-acos(s(x,y)/2); g00(y):=at(g0(x,y),x=0); g00(y);
/ Next, calculate the first derivative of the function g0(x, y) and its value at x = 0 /
g1(x,y):=diff(g0(x,y),x); g10(y):=radcan(factor(trigsimp(ratsimp((at(g1(x,y),x=0))))))$ g10(y);
/ Then, calculate the second derivative of the function g0(x, y) and its value at x = 0 /
g2(x,y):=diff(g1(x,y),x); g20(y):=radcan(factor(trigsimp(ratsimp((at(g2(x,y),x=0))))))$ g20(y);
/ Next, calculate the first derivative of the function g0(x, y) and its value at x = 0 /
g3(x,y):=diff(g2(x,y),x); g30(y):=radcan(factor(trigsimp(ratsimp((at(g3(x,y),x=0))))))$ g30(y); / [wxMaxima: input end ] /
Is it a bug, or am I making something wrong?
build_info(version="5.37.2",timestamp="2015-10-30 02:08:33",host="x86_64-unknown-linux-gnu",lisp_name="GNU Common Lisp (GCL)",lisp_version="GCL 2.6.12")
Best, Pawel
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/maxima/bugs/3553/
To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/
Attachments:
Imported from SourceForge on 2024-07-07 20:55:45 Created by kjak on 2022-01-21 21:07:04 Original: https://sourceforge.net/p/maxima/bugs/3553/#aeb1
Imported from SourceForge on 2024-07-07 20:55:30 Created by ncwerons on 2019-05-13 08:50:11 Original: https://sourceforge.net/p/maxima/bugs/3553
Hi, I have analyzed two functions of two variables x and y:
and
where
From analytical considerations I know that, for 0 < y < %pi, the first derivative of f0(x, y) with respect to x is equal to the function g0(x, y). You can double check it making a plot of the difference between diff(f0(x, y), x) and g0(x, y). Consequently, n-th derivative of f0(x, y) with respect to x should be equal to (n-1)-th derivative of g0(x, y) with respect to x. Indeed, for n < 4 it is the case. However, for n = 4 the derivatives are different. Below I have provided two short maxima cells demonstrating that. For the sake of simplicity, I have calculated the derivatives at x = 0. For n = 4 the derivatives are different by the term
cot(y)^3 / 3
, as you can find by making some algebra on the final results.Here is the first cell for calculating derivatives of the function f0(x, y):
And here is the second cell for calculating derivatives of the function g0(x, y):
Is it a bug, or am I making something wrong?
build_info(version="5.37.2",timestamp="2015-10-30 02:08:33",host="x86_64-unknown-linux-gnu",lisp_name="GNU Common Lisp (GCL)",lisp_version="GCL 2.6.12")
Best, Pawel