Adri van der Meer

Adri vanderMeer

1415 Reputation

19 Badges

20 years, 38 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

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

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

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

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)

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<S__k,g(S), v__max ):

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

 

 

 


 

Download PiecewiseGraph.mw

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]):

 

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

Download PhasePortrait.mw

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

Download SolveEq.mw

Simply use evalc:

restart;

z := a*I+b;

I*a+b

(1)

evalc(z);

b+a*I

(2)

w := z + 2*I + c;

b+a*I+2*I+c

(3)

evalc(w);

b+c+I*(a+2)

(4)

Download ComplexSort.mw

In this case the remove command can be used:

restart;

L := [seq(i,i=1..10)];

[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

(1)

M := [4,5,6]:

remove( x-> x in M, L );

[1, 2, 3, 7, 8, 9, 10]

(2)

Download RemoveListElements.mw

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

restart

y1 := 7.187089422787781449259327358097*x^2-34.149715256645549592146037526589*x^3+92.359325848696162368355511315625*x^4-135.58601962203264776595890928641*x^5+101.25962748430115463423633295003*x^6-30.114080251339988529197699896814*x^7-2.*10^(-32)+1.*10^(-31)*x:

exact := x^1.25:

Error := abs(exact-y1):

plot(Error,x=-0.1..1.1);

 

 

Download AbsError.mw

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;

-a*q^2+b*q^2+q^3-5

(1)

coeffs(pol,q);

1, -a+b, -5

(2)

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

[1, -a, b, -5]

(3)

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

[-a, b]

 

[-a = 1, b = 1]

(4)

subs(cs1,pol);

-a*q^2+q^3+q^2-5

(5)

subs(-~cs1,%);

q^3+2*q^2-5

(6)

Download UnitRoots.mw

 

Use add instead of sum for non-symbolic summation:

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

 

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

diff(diff(u(t), t), t)+u(t)+mu[s]*(diff(u(t), t))^3 = (1-mu[s])*(diff(u(t), t))*(diff(diff(u(t), t), t))

(1)

subs(u(t)=u(omega*t),eq31g); eq33a := eval( %, t=tau/omega );

diff(diff(u(omega*t), t), t)+u(omega*t)+mu[s]*(diff(u(omega*t), t))^3 = (1-mu[s])*(diff(u(omega*t), t))*(diff(diff(u(omega*t), t), t))

 

((D@@2)(u))(tau)*omega^2+u(tau)+mu[s]*(D(u))(tau)^3*omega^3 = (1-mu[s])*(D(u))(tau)*omega^3*((D@@2)(u))(tau)

(2)

#eq33a:=subs(t=tau/omega,value(subs(u(t)=u(omega*t),eq31g)));

convert(eq33a,diff);

(diff(diff(u(tau), tau), tau))*omega^2+u(tau)+mu[s]*(diff(u(tau), tau))^3*omega^3 = (1-mu[s])*(diff(u(tau), tau))*omega^3*(diff(diff(u(tau), tau), tau))

(3)

Download Torabi.mw

Which equation do you mean?

eq1 := 15-1/(100*M)=5+1/(600*M);

15-(1/100)/M = 5+(1/600)/M

(1)

solve(eq1);

7/6000

(2)

eq2 := 15-1/100*M=5+1/600*M;

15-(1/100)*M = 5+(1/600)*M

(3)

solve(eq2);

6000/7

(4)

 

Download Parentheses.mw

The imaginary unit is capital I, not lowercase i

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