## 1350 Reputation

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

My "website" consists of a Maple Manual in Dutch

## Piecewise graph...

To make an illustrative plot, give vmax and Sk arbitrary values, and use a tickmark option:

 > restart;
 > g := S -> v__max/S__k*S:
 > v := S -> piecewise( S
 > plot( eval(v(S),{v__max=1,S__k=1}),S=0..3, tickmarks=[[1=S__k,2=2*S__k],[1=v__max]], view=0..1.2  );
 >
 >

## Legend...

Use a legend option with six empty legend texts:

```A:=plot( [seq(seq(lambda(F,Nb,delta2), Nb=[0.1,0.2,0.3]), F=[0.1,0.2,0.5])],           delta2=0.02..0.1, linestyle = [solid,longdash,dashdot],'           thickness = 2',color=[red\$3,blue\$3,black\$3],           legend=["Nb=0.1","Nb=0.2","Nb=0.3",""\$6]):```

## Singularities...

I suppose that "when x = -3..3 and y = -3..3" means the initial value y(-3.3)=-3.3. The differential equation happens to have an exact solution with discontinuities.

```restart; DE := diff(y(x),x) = x^2 - y(x)^2: dsolve({DE,y(-3.3)=-3.3},y(x)): Y := subs(%,y(x)): plot(Y,x=-4..4, discont);```

So you have to plot the phaseportrait in a neighbourhood of x=-3.3.

`DEtools[DEplot]( DE, y(x), x=-4..-3, {y(-3.3)=-3.3},linecolor=blue);`

## Solve y...

Just solve for y:

restart;
eq := y^2=10161/256*t^2+8829189/25600*t+7266953961/1024000:
f := t -> [solve(eq,y)]:
seq([t,f(t)],t=-5..5);

## Sort complex number...

Simply use evalc:

 > restart;
 > z := a*I+b;
 (1)
 > evalc(z);
 (2)
 > w := z + 2*I + c;
 (3)
 > evalc(w);
 (4)

## Remove list elements...

In this case the remove command can be used:

 > restart;
 > L := [seq(i,i=1..10)];
 (1)
 > M := [4,5,6]:
 > remove( x-> x in M, L );
 (2)

## Absolute value...

I suppose that you mean the norm in the meaning of the absolute value:

 >
 >
 >
 > Error := abs(exact-y1):
 > plot(Error,x=-0.1..1.1);
 >

## Subs to unit...

There are several difficulties:

• coeffs gives the coefficients of each power of q. In your example the coeff of q^2 is b-a; so we have to split it in "-a" and "b";
• subs doesn't want to subs -a=1, so we make it a=-1.
 > restart;
 > pol := q^3-a*q^2+b*q^2-5;
 (1)
 > coeffs(pol,q);
 (2)
 > cs :=map(op,[coeffs(pol,q)]);
 (3)
 > remove(type,cs,'numeric'); cs1 := %=~1;
 (4)
 > subs(cs1,pol);
 (5)
 > subs(-~cs1,%);
 (6)

```restart; L := [[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]: add(L[i,1],i=1..5);                                11```

## Use eval...

Perhaps you mean:

 > restart; eq31g := diff(u(t),t\$2)+u(t)+mu[s]*(diff(u(t), t))^3 = (1-mu[s])*(diff(u(t), t))*(diff(u(t),t\$2));
 (1)
 > subs(u(t)=u(omega*t),eq31g); eq33a := eval( %, t=tau/omega );
 (2)
 > #eq33a:=subs(t=tau/omega,value(subs(u(t)=u(omega*t),eq31g)));
 > convert(eq33a,diff);
 (3)

## Parentheses...

Which equation do you mean?

 > eq1 := 15-1/(100*M)=5+1/(600*M);
 (1)
 > solve(eq1);
 (2)
 > eq2 := 15-1/100*M=5+1/600*M;
 (3)
 > solve(eq2);
 (4)
 >

## Replace i by I...

The imaginary unit is capital I, not lowercase i

## Allsolutions...

The exponential function a^b is defined as exp(b*ln(a)). If a<0, than ln(a) is the multi-valued complex function ln(-a)+πi+2kπi. You can find these by using the option allsolutions:

 > restart;
 > s := solve(diff(-1/x,x) = (-1/x)^(b), b, allsolutions);
 (1)
 > simplify(eval(s,_Z1=1),symbolic);
 (2)
 >

For the second equation there seems do be no solution independent of x.

## Elliptic domain...

You may define the vectorfield [0,0] outside the ellipse:

 > restart; with(plots):
 > f := (x,y) -> if x^2+y^2/2 <= 1 then x^2+y^2 else 0 end if:
 > g := (x,y) -> if x^2+y^2/2 <= 1 then x+y else 0 end if:
 > fieldplot( [f,g], -1.5..1.5,-1.5..1.5, arrows=slim );
 >

## Perhaps you mean......

I suppose that you want to plot a parametrized surface, that is a list [x(u,v),y(u,v),z(u,v)].
This van be done ad follows:

 > restart;
 > S := (u,v) -> 10*u^2*v+20*u*v+15:
 > p:= proc(u,v) if u
 > plot3d([40*u,80*v,'p(u, v)'], u = 0 .. 1, v = 0 .. 2*u); #use quotes to prevent premature evaluation
 >