## 1350 Reputation

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

My "website" consists of a Maple Manual in Dutch

## Use typeset...

```plots:-textplot( [M2,1.15*P2,typeset(``(M2,1.15*P2))] );
```

## evalf...

Replace

`y[0] := (1/4)*Pi;`

by

`y[0] := evalf((1/4)*Pi);`

## Spline of degree 1...

If you don't care about the values of the piecewise function for x<xmin or x>xmax , then the easiest way is:

`f := CurveFitting:-Spline([[0,2],[3,-2],[7,6],[9,5]], x, degree=1 );`

## Not possible...

Your example is a function R3R2,, so there cannot exist an inverse.

## To build an Array...

Because the number of rows is not fixed in advance, you can better build a sequence of rows. Not that I also made your global R local:

`S := proc (x, a, b, s)`
`  local R; global y;`
`  R := NULL: # initialization`
`  for y from a by s to b while y < 1`
`  do R := R, [y,ListTools:-FindMinimalElement(select(type, [fsolve(f(x) = 0)], positive ))] # the next row`
`  end do;`
`  Array([R]) # form the Array as output`

end proc;

Now you can get the Array by

`R := S(...);`

## Some other problems...

What do you mean by "evaluate"? If you want to view the entries of the matrix, right click on the output and choose "browse" , or make the maximum size of shown matrices larger by

`interface(rtablesize=11);`

There are two other problems:

(1) You use e^... for exponentials. This must be: exp(...)

(2) There is an undefined function vb

## Which matrices?...

(1) Are the first two lines meant as assignments? Then you have to use z1 := ... instead of z1 = ...

(2) z1 and z2 are lists (not matrices), consisting of 10 elements. In eq1 you have powers of  z1 and z2 , so these must be square matrices. But what do you mean by the square root of a matrix?

## Current directory...

The command

`currentdir();`

returns the desired string

## Implicitplot...

The solution of the ODE is given in implicit form. So you can use implicitplot to plot solutions for different values of _C1:

`plots:-implicitplot( [s], x=-4..4, y=-4..4, gridrefine=2 );`

## General case...

You must substitute x2=1/x2b etc. for all variables in the denominator. So try:

`k := indets(denom(f)):`
`s := a -> a=1/a||b:`
`eval(f,s~(k));`

## Which "Basis"?...

The packages LinearAlgebra and Groebner both have a command "Basis".  You load LinearAlgebra after Groebner, so when Basis is used, it is the LinearAlgebra-version. So: omit the statement with(LinearAlgebra) - don't forget to restart -, or, if you need both packages, do:

Groebner:-Basis( ...

## Don't use D...

Because D is the name of the differential operator, try for instance

`D(sin);`

see ?D

So, use another symbol instead of D.

## Parametric plot...

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

## Don't use Re...

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

`A := parse(readline("ConservationEq.txt"));`