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

I assume that diff(Q(t),t) is meant to be the positive sqrt of diff(P(t),t). You need an initial value.
For example a value a, such that Q(a)=0:

  P := t -> t*ln(t)^(-b);
  Q := t -> Int( sqrt( D(P)(tau) ), tau=a..t );

To make a (parametric) plot, you need numerical values for a and b:

  a := 3.0: b:=1.0:
  plot( [evalf(Q(t)),1/P(t)^2, t=a..20], labels=["Q",typeset(1/` P`^2)] );

 

(1) Don't use Re as the name of a variable (because it means the real part of a complex number)

(2) You mistyped a " * " for a comma in the solve command.

sys := {Reyn = ID*V/nu, hl = (f*L/ID+Kl)*V^2/(2*9.81),        
            Vflow = (1/4)*Pi*ID^2*V, Hrequired = alpha*V^2/(2*9.81)+hl,
           Hrequired = -a*Vflow^2+Ho, 1/sqrt(f) = -1.8*log[10](6.9/Reyn+(E/(3.7))^1.11)};

solve(sys, {Reyn, V, f, hl, Vflow, Hrequired});

You seem only want to read just one maple expression. I think that ImportMatrix is not the most appropriate command for that.

A := parse(readline("ConservationEq.txt"));
with(LinearAlgebra):
NewMatrix3 := Matrix(3, 3, {(1, 1) = test10, (1, 2) = 5.59, (1, 3) = 5.74,
         (2, 1) = 5.59, (2, 2) = 5.74, (2, 3) = 0,
         (3, 1) = 5.74, (3, 2) = 0, (3, 3) = 0}):
ev := x -> simplify( Eigenvectors(eval(NewMatrix3,test10=x))[2], zero );
ev(4);

See ?do

If the expression in the while clause returns false, the repetition statement is terminated. So, when i=1: "i>=5" is false, and the loop terminates. You can do:

for i from 1 to 10 do if i>=5 then print(i) end if end do;

Change your indexing function, for example

M := Matrix(3,(i,j) -> if i=j then Re(a||i||j + I*b||i||j) 
                              else a||i||j + I*b||i||j
                       end if, shape = hermitian);

You have to enter the ODE's and the initial values as one list or set:

sol := dsolve( {epsilon*(diff(x(t), t)) = x(t)+y(t)-q*x(t)^2-x(t)*y(t), 
                diff(y(t), t) = h*z(t)-y(t)-x(t)*y(t),
                p*(diff(z(t), t)) = x(t)-z(t),
                x(0) = 100, y(0) = 1, z(0) = 10}, type = numeric);

...that can also be used when the intervals do overlap:

plot( [[r,FOO(r),r=0.5..2],[r,g(r),r=0.2..0.7]] );
knn := Vector( 10, m -> fsolve( 1/kn=-tan(kn),kn=(m-1)*Pi..m*Pi ) );

If you want to find phi when r(phi)=2/3, you can better use fsolve:

DE:=diff(1/r(phi),phi,phi)+(1/r(phi))=(G*M/h^2)+(3*G*M/c^2*r(phi)^2);
ics:=r(0)=2/3,D(r)(0)=0:
G:=1: M:=1: h:=1: c:=1:
p:=dsolve({DE,ics},numeric, output=listprocedure);
R := subs(p,r(phi)):
phi0 := fsolve( R(phi)=2/3, phi );
                                      -8
                        4.000248446 10  
dR := subs(p, diff(r(phi),phi) ):
dR(phi0);
                 HFloat(-1.4815734985186228e-8)

You have 5 equations that you want to solve for 18 variables. Which 5 variables do you want to express in the other 13? There exist many (trivial) solutions, for example:

restart;
eqs := {d^2*lambda^2+r^2*kappa^2+(x^2-1)*omega^2 = 0,
        (a^2-1)*lambda^2+m^2*kappa^2+t^2*omega^2 = 0,
        a*exp(-I*alpha)*b*exp(I*beta)*lambda^2+m*exp(-I*mu)*n*exp(I*nu)*kappa^2+
           t*exp(-I*tau)*p*exp(I*psi)*omega^2 = 0,
        a*exp(-I*alpha)*d*exp(I*delta)*lambda^2+m*exp(-I*mu)*r*exp(I*rho)*kappa^2+
           t*exp(-I*tau)*x*exp(I*xi)*omega^2 = 0,
        b*exp(-I*beta)*d*exp(I*delta)*lambda^2+n*exp(-I*nu)*r*exp(I*rho)*kappa^2+
           p*exp(-I*psi)*x*exp(I*xi)*omega^2 = 0}:
vars := {a, b, d, m, mu, n, nu, p, psi, r, rho, t, tau, x, xi, alpha, beta, delta}:
s := solve( eqs, vars ):
nops([s]);
                               36
s[1];
{a = 1, alpha = alpha, b = 0, beta = beta, d = 0, delta = delta,
m = 0, mu = mu, n = n, nu = nu, p = 0, psi = psi, r = 0,
rho = rho, t = 0, tau = tau, x = 1, xi = xi}

eq := x^2+y^2=6;
dy := implicitdiff(eq,y,x);
Y := solve( eval(eq,x=3/2) ); # Two solutions!
eval( dy, {x=3/2, y=Y[2]} );

Parentheses don't match, and you use a period for multiplication.

sqrt(M+m)*sqrt(M-m)*sqrt(M+m)*sqrt(M-m);

I'm not sure what you want exactly, but there are a few things that prevent tour procedure to work properly:

(1) You don't give a dimension for the Array S;

(2) You forgot the colon in several assignments

(3) To test if two vectors are equal, use a LinearAlgebra:-Equal command

Perhaps this version of the procedure works as you intend?

Cerny1:=proc(A::Matrix,B::Matrix,C::Vector[row],N)
local x, S, i, j, T, R, y;
  x:=(N-1)^2;
  S:=Array(0..2^N);
  S[0]:=C;
  i:=0;
  j:=0;
  while (i<(2^N)) do
    T:=S[i].A;
    S[j]:=T;
    j:=j+1;
    R:=S[i].B;
    S[j]:=R;
    i:=i+1;
    for y from 0 to j do
      if LinearAlgebra:-Equal(S[y],T) then S[i]:=S[i]-T end if
    end do
  end do:
  S;
end proc;

(I didn't test if the output with random matrices and a rendom vector makes sense).

plots:-polarplot( sin(3*phi), phi=0..2*Pi, axiscoordinates=cartesian, axes=boxed );

First 6 7 8 9 10 11 12 Last Page 8 of 27