Adri van der Meer

Adri vanderMeer

1400 Reputation

19 Badges

20 years, 135 days
University of Twente (retired)
Enschede, Netherlands

My "website" consists of a Maple Manual in Dutch

MaplePrimes Activity


These are answers submitted by Adri van der Meer

allvalues( solve(a*mu^4+b*mu^3+c*mu^2+d*mu+e=0 ,mu) );

See ?dsolve/numeric/interactive: you have to fill in the values of k and mu in sol:

...
k := DocumentTools:-GetProperty('kSlider', 'value');
mu := DocumentTools:-GetProperty('muSlider', 'value');
sol(parameters=[k,mu]);
p1 := odeplot(sol, [t, x(t)], t = 0 .. 25, colour = red);
...

See the help pages ?dsolve/numeric and ?odeplot

From the help page: "Attempting to assign to an element outside the bounds of the given array will result in an out-of-bounds exception with square-bracket indexing. This provides protection from accidentally assigning to an element outside your initial boundaries.  Using round-brackets, assigning to an out-of-bounds element will cause the array to grow so that it can hold that element."

For example:


A := Array(1..2,1..2);

A := Matrix(2, 2, {(1, 1) = 0, (1, 2) = 0, (2, 1) = 0, (2, 2) = 0})

(1)

A[1,1] := 3: A;

Matrix(2, 2, {(1, 1) = 3, (1, 2) = 0, (2, 1) = 0, (2, 2) = 0})

(2)

A(3,4) := 7: A;

Matrix(3, 4, {(1, 1) = 3, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 1) = 0, (2, 2) = 0, (2, 3) = 0, (2, 4) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 0, (3, 4) = 7})

(3)

 


Download DynamicArray.mw

int( int( int( expand( (4-6*(x+z)+12*x*z)*(y^4-y*(y-z)^3+x^3*z-z*(x-y)^3) ),
 x=0..1 ), y=0..1), z=0..1 );
                               1
                               -
                               3

Perhaps you forgot a multiplication sign somewhere?

What you try to achieve with the unapply statement can better be done in another way.
Remember that a gradient is a vectorfield. Try

Df := Gradient(f(x, y), [x, y]);
About(Df);

A vectorfield can be evaluated in a certain point by

 v := evalVF(Df,<1,1>);
About(v);

The result is a rooted vector. The command GetRootPoint returns the root point.

I don't understand either the discrepancy between your gradf(x,y) and gradf(1,1). I expected an errormessage for the second instance. By the way, gradf(u,v) gives a rather weird errormessage!

(1) in f there is no else clause. For example:

f := proc (x) 
  if 0 < x and x < evalf(Pi) then 1
  elif evalf(Pi) < x and x < evalf(2*Pi) then -1
  else 0 end if
end proc:

(2) You can avoid premature evaluation by making f1 a procedure:

 f1 := x -> add((-1)^n*f(x-evalf(2*n*Pi)), n = 0 .. 10):
plot(f1,0..6*Pi);

Alternative: use piecewise:

 f := x -> piecewise( x<-Pi, f(x+4*Pi), x<Pi, 1, x<3*Pi, -1, f(x-4*Pi) ):
plot( f, -6*Pi..6*Pi );

A cleaner approach and following your own suggestion on the definition of g:

f := unapply(g,a,b);
w := proc(a,b)
f(a,b) + 14
end proc;

Because you have proved the existence of the limit, it must be a solution of the equation
a = (a +2)/(a + 3). So, simply choose the right answer from the solutions of

solve( a = (a +2)/(a + 3) );


p1 := plots:-polarplot(2+cos(x), x = 0 .. 2*Pi, color = red, filled=[color=yellow] ):
p2 := plots:-polarplot(2, x = 0 .. 2*Pi, color = blue, filled=[color=white]):
plots:-display( [p2,p1] );

It is not quite clear what you mean by "assign a name for a and another for b", probably you want to assign a value to the variables that ara solved for. In that case:

s := solve({-a+4*b = 0, 2*a+7*b = 2}, {a, b});
A := subs(s,a); B := subs(s,b);

If you definitely want to assign values to the variables a and b, you can simply do:

assign(s);
restart;
p:=f(x)^2 + g(x)^3:
                             2       3
                         f(x)  + g(x)
alias( f=f(x), g=g(x) );
                              f, g
p;
                             2    3
                            f  + g
diff(p,x);
                       / d   \      2 / d   \
                   2 f |--- f| + 3 g  |--- g|
                       \ dx  /        \ dx  /

Using subs is not a good idea, because in that case you lose the information that f and g are functions of x.

Make p1 the plot of the curve:

p1 := plot( f(x), x=... ):

Now make a list of plots, consisting of several (many) normal lines:

N := [ seq( plot( normal(i), ... ), i= ... ) ]:

The animation of these normals:

p2 := plots:-display( N, insequence=true ):

and the final picture:

plots:-display( {p1,p2}, scaling=constrained, view= ... );

The scaling option is important, to see that the normal is perpendicular to the curve!

Use the output=list option to calculate the eigenvalues and eigenvectors

 with(LinearAlgebra):
A := evalf(RandomMatrix(5,generator=rand(-2..5)));
eig := Eigenvectors(A, output=list);
s := sort( eig, (x,y)->abs(x[1])<abs(y[1]) );
S := s[1..5,1]; # Sorted list of eigenvalues
V := Matrix( op~(s[1..5,3]) ); # the matrix of eigenvectors

Now you can get the ordered eigenvalues by S[1], S[2], etc.

  • The constant k has no value
  • There are several typo's

This works:

k := 1:
phaseportrait([DE, DF], [y, x], t = -5 .. 5,
  [[y(0) = 1, x(0)=1], [y(0) = 0, x(0) = 2], [y(0) = 0, x(0) = -2]],
   y = -5 .. 5, x = -5 .. 5, color = black, linecolor = red);


First 14 15 16 17 18 19 20 Last Page 16 of 27