Adri van der Meer

Adri vanderMeer

1345 Reputation

16 Badges

14 years, 6 days
University of Twente (retired)
Enschede, Netherlands

My "website" consists of a Maple Manual in Dutch

MaplePrimes Activity

These are replies submitted by Adri van der Meer

@kfli Use



@waseem What is the question? Do you mean something like:

restart; with(plots):
f := x -> x+1:
pp := pointplot( [seq([x,f(x)],x=0..10)], symbol=solidcircle, symbolsize=20, color=red ):
pl := plot( f, 0..10, thickness=2, color=red ):
display( {pp,pl}, view=[0..11,0..11] );


@Adam Ledger In the command remove(f,L), f must be a boolean-valued procedure.

@Adri van der Meer This procedure doesn't work properly if the polynom has coefficients of the form -c.
So I made a correction:


pol := q^3-a*q^2+b*q^2-5-c*q^4;




-c, 1, -a+b, -5



[-1, c, 1, -a, b, -5]


# op(-c) is -1,c. Only sums have to be splitted:

nplus := x -> if type(x,`+`) then op(x) else x end if:

cs :=map(nplus,[coeffs(pol,q)]);

[-c, 1, -a, b, -5]


remove(type,cs,'numeric'): cs1 := %=~1;

[-c = 1, -a = 1, b = 1]


subs(cs1,pol): newpol := subs(-~cs1,%);





@carriewong For example, if z takes values in the square -2-2i (bottom left) to 2+2i (top right):


@Axel Vogt If F is defined by "->", the right hand side stays unevaluated until it is called as F(x). So, when f changes after the definition of F, F changes too. If "unapply" is used, the right hand side is evaluated, so changing the definition of f has no effect on F.

f := x -> x;

proc (x) options operator, arrow; x end proc


F1 := x -> int( f(X), X=0..x );

proc (x) options operator, arrow; int(f(X), X = 0 .. x) end proc





F2 := unapply( int( f(X), X=0..x ), x );

proc (x) options operator, arrow; (1/2)*x^2 end proc


f := x -> sin(x)*cos(x):









@H-R My second suggestion is meant for the general case, where x(t), y(t) are the coordinate functions. There is, of course, no need to calculate the tangent vector: just make an arrow from one point on the curve to another.

x,y := t->cos(t), t->sin(t):
p1 := plot([x(t),y(t),t=0..2*Pi] ):
p2 := plottools:-arrow( [x(Pi/4),y(Pi/4)],[x(Pi/4+0.05),y(Pi/4+0.05)], 0.03,0.05,1 ):
plots:-display( {p1,p2} );

@AngelaRURU Perhaps it resides in the startupcode? Ctrl+Shift+E

@vahid65 See my previous answer.

Note that you solve for x in the command c := solve(...), and assign the result to the variable c.
so you have to apply the condition to x, i.e. solve simultaneously one equation:
limit( (f(x+h)-f(x))/h, h=0 )= (f(b)-f(a))/(b-a),
and two inequations:
x>a, x<b

now the answer comes in the form:

and to assign this value to te variable c:
c := subs(%,x);

Try to find out what to do if there are more solutions in the interval (a,b).
Hint: [solve( ... )] and use subs~(...), see ?Element-wise Operators

@farzane you need the second operand of the second element of the output:


@asa12 use a parametrization for the surface:

plot3d( [0,y,z], y=0..1, z=0..1, axes=normal );

for example this question     .

@shadi1386 Apply LeastSquares to the logarithm of the dependent variable:

XYlist := zip( (x,y) -> [x,ln(y)], xlist,flist):
p1 := plot(XYlist):
LS := LeastSquares( XYlist, x, curve=add(a[i]*x^i, i=0..7) );
p2 := plot( LS, x=0..1 ):
plots:-display( {p1,p2} );

@shadi1386 If you (only) want to calculate the integral, the data are so detailed that a straightforward Riemannsum (like my answer of sept 28) will give a good result. But if the purpose is a single formula that fits the data, then use CurveFitting:-LeastSquares

@Markiyan Hirnyk Right! I forgot an expand in nops (answer corrected). Of course a procedure is more elegant (like Stephen Forrest did).

1 2 3 4 5 6 7 Last Page 1 of 11