Adri van der Meer

Adri vanderMeer

1350 Reputation

18 Badges

14 years, 249 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

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

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

2*(I*Pi*_Z1-ln(x))/ln(-1/x)

(1)

simplify(eval(s,_Z1=1),symbolic);

2

(2)

 

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

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

 

 


 

 

 

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<v then S(u,v) else S(u,v)+10 end if end proc:

plot3d([40*u,80*v,'p(u, v)'], u = 0 .. 1, v = 0 .. 2*u); #use quotes to prevent premature evaluation

 

 


 

Download SubSurface.mw

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