## 17642 Reputation

14 years, 191 days

On google groups. (comp.soft-sys.math.maple and sci.math.symbolic)

On stackoverflow.

On math.stackexchange.com.

## an example...

My first advice is to use the top menu to do File->New->Worksheet Mode , and then Tools->Options-Display and set Input display to Maple Notation. For a new user trying to understand maple programming and syntax, this would be a better mode for using Maple. F:=(X^5) + 3*(X^2)+1; dFX := diff(F,X); Xo:=-2; eval(F,X=Xo); eval(dFX,X=Xo); for i from 1 to 10 do Xnew := evalf( Xo - eval(F,X=Xo)/eval(dFX,X=Xo) ); Xo := Xnew; end do; I have used expressions above, instead of functions. Georgios' suggestion to look at the functional operators page is good too. You can use expressions, as I did above, or functions (operators) as he shows. What won't work is the mismatch between the two which you originally tried. don't feel bad about it. It's a common initial misunderstanding about Maple. acer

## lprint...

I'm not quite sure what you are after. Is lprint() sufficient, to give your expression back in a format suitable for subsequent maple input? Eg, f := (a^5+b^5)/(a+b): lprint(f); Or, do you have some other examples for which you want to delay any evaluation or simplification at all, prior to printing. Eg, (x+2*x)/7 is the expression say and you wish to prevent the numerator from simplifying to 3*x ? There are a few tricks for that, one of the weakest of which is, f:=`(x+2*x)/7`; parse(f); acer

## RootFinding[Isolate], Descarte rules of ...

If you wish to apply some theory yourself then you could first try a web search for Descarte's rules of signs, or the Sturm theorem. In Maple 11, for a univariate polynomial with rational real coefficients the new command RootFinding[Isolate] can bracket the roots within rational intervals. Judging by the Description in its Maple help-page the underlying methods that it uses do not work internally with floating-point numbers, and do not miss roots due to round-off or related issues. You did not mention whether the coefficients are rational or floating-point. If any of the coefficients are floating-point real number approximations then you could use fsolve rather than RootFinding[Isolate] directly. acer

## Optimization[LSSolve]...

Could you instead use the Matrix-form of Optimization[LSSolve] and provide the restriction (to avoid a subregion whose boundary is described by your "complicated function" of the two parameters) as an additional constraint? acer

## You are missing an assignment to A...

You probably wanted your second line to be like this, so that A gets assigned the procedure. A := proc (k) As posted, there was only the start of an equation, like this, A = proc (k) acer

## that doesn't look right...

I am guessing now that you are using Document mode, or are entering the commands in 2Dmath input. I think that the 2Dmath input parser might get confused by (A.x+B). I suggest you do it in a new Worksheet instead. That is, from the menubar, File -> New -> Worksheet Mode. Alternatively, try this slight modification which may be OK in Document Mode. A := Matrix([[-1,0],[1,-2]]); B := Vector([1,-1]); x := Vector([x1(t),x2(t)]); xprime := map(diff,x,t); Q := A.x + B; eqn1 := xprime = Q; eqn2 := xprime = Q; dsolve({eqn1,eqn2,x1(0)=1,x2(0)=0},{x1(t),x2(t)}); Hopefully you will then see this output, {x2(t) = 0, x1(t) = 1} which I hope illustrates the unfortunate trivial solution. I suggest treble-checking that the entries of A and B are correct. ps. For those who enjoy such things, compare this in Document Mode vs Worksheet Mode, in Maple 11, M := Matrix([a]); N := Matrix([b]); (M.N)[1,1]; (M.N+N)[1, 1]; acer

## problems with nontrivial solutions are m...

The X and Y and just dummy names for the first and second component of the Vector x. You could just as easily call then x1 and x2. For example A := Matrix([[-1,0],[1,-2]]); B := Vector([1,-1]); x := Vector([x1(t),x2(t)]); xprime := map(diff,x,t); eqn1 := xprime=(A.x+B); eqn2 := xprime=(A.x+B); dsolve({eqn1,eqn2,x1(0)=1,x2(0)=0},{x1(t),x2(t)}); Look at how, in your own attempt, you mixed up Matrix equations and the scalar diff(x(t),t) since you did not define x as a matrix or vector. Look instead at how in my example the x and xprime are Vectors. So, I set everything up as a Matrix or Vector, that is, the A, the B, the x(t), and the dx(t)/dt . Then I pull out two equations, to form a system of differential equations. The first equation is take from the top row of all those Matrix and Vector objects, and the second equation is taken from the bottom row of them. Study that. Then I call dsolve, with the whole system. The reason that it is uninteresting is that the only solution, for the data you gave, is the trivial solution of {x1(t) = 1, x2(t) = 0}. That solution is the same, for all t, which is dull. For other choices of A, more interesting solutions which actually depend on t might arise. acer

## Are you sure you got the question down c...

Are you sure you got the question down correctly? I see that the sign of A[2,2] has changed, since your first attempt to post the question. A := Matrix([[-1,0],[1,-2]]); B := Vector([1,-1]); x := Vector([X(t),Y(t)]); xprime := map(diff,x,t); eqn1 := xprime=(A.x+B); eqn2 := xprime=(A.x+B); dsolve({eqn1,eqn2,X(0)=1,Y(0)=0},{X(t),Y(t)}); Are you sure that A wasn't something more interesting, like say Matrix([[-1,0],[-1,-2]]) ? acer

## your simple commands would be eval and d...

Note the capitalization of Pi. s:=8*cos((sqrt(2)/5)*Pi*t); eval(s,t=0); dsdt := diff(s,t); d2sdt2 := diff(s,t,t); # for fun plot(d2sdt2,t=0..10); acer

If you wish to code this yourself, use `add` instead of `sum`. But you might also use ArrayTools[AddAlongDimension] . acer

## Digits is set to 10, by default...

> Digits := trunc(evalhf(Digits)): > evalf(e_x0); 0.000272945525314361 > evalf(e_x0); .000272945527768874577097831048276 Look at the help-page ?Digits . Other systems may have a different default working precision (or accuracy goal). acer

## for example...

# Setting Digits higher than this may require fiddling # with the epsilon and digits options of evalf/Int # This is optional, regardless, so only increase if it's needed. Digits := 13; interface(rtablesize=15); # S is a list of the first 11 nonnegative roots of -BesselJ(1,x) ? # If so, then find these using fsolve with avoid={} option, or with plot. S := [0., 0.3831705970, 0.7015586670, 1.017346814, 1.332369194, 1.647063084, 1.68438, 1.961585851, 2.276008438, 2.590367209, 2.904682853, 3.218967991]: B := Vector(11,(i)->`if`(i=1,1,S[i]*coth(S[i]))): A := Vector(11,(i)->2/(100*BesselJ(0,S[i]*10)^2)): C := Matrix(11,11, (i,j)-> B[j]*A[i]/1 * ( evalf(Int(BesselJ(0,S[i]*x)*BesselJ(0,S[j]*x)*x^(15.0/200.0),x=0.0..0.075)) + evalf(Int(BesselJ(0,S[i]*x)*BesselJ(0,S[i]*x)*BesselJ(0,S[j]*x)*x,x=0.076..10.0)) ) ); CI := C + LinearAlgebra[IdentityMatrix](11); LinearAlgebra[MatrixInverse](CI); acer

## Digits for precision....

Setting Digits will change the precision for calculations. If you change it once, at the top-level, then that change persists. Setting interface(rtablesize) changes the cutoff for sizes, above which once sees the "summary" of a Matrix/Vector/Array and below which one sees all the entries printed explicitly. Here too, you only need to set it once, and the change persists until you change it again or restart your session. acer

## Tools -> Options -> Precision...

Try the Tools -> Options -> Precision tab, in the Standard GUI. If you want to control the number of displayed digits without changing the precision of calculations then toggle-on the first choice, labelled "Round screen display to". acer
﻿