## 1400 Reputation

19 years, 96 days
University of Twente (retired)
Enschede, Netherlands

My "website" consists of a Maple Manual in Dutch

## Multiplication sign...

Use * (asterisk) instead of . (dot) for multiplication:

x1 := solve(x1+2/3*x2=0,x1);

## Other ways...

```plot( [Re(f(x)),Im(f(x)),abs(f(x))], x=0.2..0.4,        legend=["Re(f)","Im(f)","|f|"] );```

## no parentheses:...

```while k<100000 do x:=f(x): k:=k+1 :   if(x>0 and x<1) then a:=a+1   elif x<2 then b:=b+1   elif x<3 then c:=c+1   elif x<4 then d:=d+1   end if : end do: ```

(edited)

## 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)
 >