From: Leo B. <Leo...@um...> - 2023-10-17 18:32:45
|
On Tue, Oct 17 2023, Daniel Volinski via Maxima-discuss <max...@li...> wrote: > ******************************************************** > Caution: This message was sent from outside the University of Manitoba. > ******************************************************** > > Hi All, > I have the following code: > declare([a,b,y_a,y_b],constant)$ > > atvalue(y(x),x=a,y_a)$atvalue(y(x),x=b,y_b)$ > assume(a<x,x<b)$ > > Eq0:'diff(y(x),x,2)=u(x); => 'diff(y(x),x,2) = u(x) > Eq1:integrate(Eq0,x,a,x); => 'diff(y(x),x,1)-'diff(y(a),a,1) = 'integrate(u(x),x,a,x) A bit of part-hacking will give you what you want: subst(part(Eq1,1,2,1)='at(diff(y(x),x,1),x=a),Eq1); ---- matchdeclare + tellsimpafter will also do the substitution automatically: display2d:false $ matchdeclare(CCC,constantp,AAA,true); block([simp:false], tellsimpafter('diff(AAA,CCC,1), at('diff(subst([CCC=x],AAA),x,1),x=CCC))); declare(a,constant); Eq0:'diff(y(x),x,2)=u(x); integrate(Eq0,x,a,x); #+begin_example (%i1) display2d:false $ (%i2) matchdeclare(CCC,constantp,AAA,true); (%o2) done (%i3) block([simp:false], tellsimpafter('diff(AAA,CCC,1), at('diff(subst([CCC=x],AAA),x,1),x=CCC))); (%o3) [derivativerule1,simpderiv] (%i4) declare(a,constant); (%o4) done (%i5) Eq0:'diff(y(x),x,2)=u(x); (%o5) 'diff(y(x),x,2) = u(x) (%i6) integrate(Eq0,x,a,x); (%o6) 'diff(y(x),x,1)-%at('diff(y(x),x,1),x = a) = 'integrate(u(x),x,a,x) #+end_example > > Eq2:subst(['diff(y(a),a,1)=y\'(a)],Eq1); => 'diff(y(x),x,1)-'diff(y(a),a,1) = 'integrate(u(x),x,a,x) If you evaluate 'diff(y(a),a,1), you will see that Maxima evaluates that to 0. Leo > > The first error is in Eq1, the result contains 'diff(y(a),a,1) which > makes no sense.The second error is in Eq2, I'm unable to do the > substitution of the error. > If I delete atvalue(y(x),x=a,y_a)$ and run all again the substitution > is OK.If I do the integration with limits a and b, then both terms of > the left-hand side are incorrect. > Is there any way to fix it?Thanks, > Daniel Volinski > > _______________________________________________ > Maxima-discuss mailing list > Max...@li... > https://lists.sourceforge.net/lists/listinfo/maxima-discuss |