## 15 Badges

9 years, 213 days

## There are many ways...

to plot a torus. The attached shows three simple ways to produce the "same" torus.

There are almost certainly other ways!

Which of these you choose is entirely up to you.

 > # # Initialize. Load plots() and plottools() #   restart;   with(plottools):   with(plots): # # Define two parameters for the torus - the # "major" and "minor" radii #   R:= 5: # torus major radius   r:= 1: # torus minor radius # # First way to plot torus - from coordinate # definitions supplied by OP #   X:= (theta, phi)-> (R+r*cos(theta))*sin(phi):   Y:= (theta, phi)-> (R+r*cos(theta))*cos(phi):   Z:= (theta, phi)-> sin(theta):   p1:=  plot3d( [X(x,y), Y(x,y), Z(x,y) ],                 x=0..2*Pi,                 y=0..2*Pi,                 scaling=constrained,                 axes=boxed,                 view=[ -R-r-1..R+r+1,                        -R-r-1..R+r+1,                        -R-r-1..R+r+1                      ]               ); # # Second way to plot torus - uses plottools:-torus() # command #     p2:= display( torus                 ( [0, 0, 0],                   r,                   R                 ),                 scaling=constrained,                 axes=boxed,                 view=[ -R-r-1..R+r+1,                        -R-r-1..R+r+1,                        -R-r-1..R+r+1                      ]               ); # # Third way to plot torus - uses plots:-tubeplot() # command #     p3:= tubeplot( [R*cos(t), R*sin(t), 0],                  t=0..2*Pi,                  radius=r,                  scaling=constrained,                  axes=boxed,                  view=[ -R-r-1..R+r+1,                         -R-r-1..R+r+1,                         -R-r-1..R+r+1                       ]                );
 >
 >

Download plotTorus.mw

## You need...

a value for the parameter 'ATank' becuase this is defined nowhere. It is also simpler to assign a value to 'pBegin' before solving the ODE.

See the attached, which now plots. I "guessed" a value for 'ATank'. You will need to change this to something realistic

Setup

 >
 >
 >
 >
 >
 (1.1)
 >
 (1.2)
 >
 >
 (1.3)
 >
 (1.4)
 >
 >
 >
 >
 >
 >
 >

Boyle's law

 >
 (2.1)
 >
 (2.2)
 >
 (2.3)
 >
 (2.4)
 >
 (2.5)

Conservation of Energy

db is much smaller then da, herfore va is neglected.

 >
 (3.1)
 >
 (3.2)
 >
 (3.3)
 >

Conservation of Mass

 >
 (4.1)
 >
 >
 (4.2)
 >
 (4.3)
 >
 >
 >

Download odeProb.mw

## Maybe...

you meant the calculation in the attached.

For future reference, please upload a worksheet illustrating your problem using the bi green up-arrow in the Mapleprimes toolbar.

When you use cut-and-paste, it is difficult for responders here to distnguish between input, output and comments

 > restart;
 > ProjPoint := proc (expr, P)#expr equation de droite D, ax+by-1=0 et P point de coordonnées [a0,b0]                     local a, b, c, xM, yM, t;                     a := coeff(expr, x);                     b := coeff(expr, y);                     c := tcoeff(expr, [x,y]):#added second argument to extract "constant" term                     t := -(2*a*P[1]+2*b*P[2]+2*c)/(a^2+b^2);                     xM := simplify(P[1]+(1/2)*t*a);                     yM := simplify(P[2]+(1/2)*t*b);                     return [xM,yM]              end:
 > ProjPoint(x*k/(a0*k-b0)+y*k/(b0*k+a0)-1, [a0, b0])
 (1)
 >

Download procProb.mw

## Another way...

see the attached

 > restart; # # Solution with posted expression and assumptions #   assume( x>0, x<1);   expr1:=((2*n-1)*x + 2*n + 1)*x^n = 1 - x;   sol1:=solve(expr1, x, useassumptions);   limit(sol1, n=infinity);
 (1)
 > # # Same again with n=2*m #   expr2:=subs( n=2*m, expr1);   sol2:=solve(expr2,x, useassumptions);   limit(sol2, m=infinity)
 (2)
 >

Download asymptotes.mw

## Try...

`int(1/x, x = 1 .. t) assuming t>1;`

## Observation...

This is one of these case where (as Carl has said), it is probably easier to rewrite your ODE using brain-power rather than Maple. On the other hand, you can use the latter if you want to - see the attached

 > restart;   expr:= dx+4*x*dy/y = dy*a*y^(-6*b-1);   dsolve(algsubs(dy/dx=diff(y(x),x),subs(y=y(x),expand(expr/dx)) ));
 (1)
 >

Download solveODE.mw

## Like this?...

see the attached

 > restart;   c := x -> piecewise(0 <= x and x <= 450000, 0.37*x, 450000 < x, 0.37*x + 0.06*(x - 450000)):   g := x -> piecewise(0 <= x and x <= 558000, 0.37*x, 558000 < x, 0.37*x + 0.12*(x - 558000)):   plots:-animate( plot,                   [ [g(x), c(x)],                     x = 0..skat,                     color = [red, blue],                     legend=['g(x)', 'c(x)']                   ],                   frames = 20,                   skat = 0 .. 1000000                 );
 >
 >

Download animleg.mw

## Errrr - works in Maple 2018!??...

see the attached

 > restart; interface(version); Physics:-Version(); sys:=[diff(Y(x, t), t, t) = 0, Y(x, 0) = 0, (D[2](Y))(x, 1) = 0]; pdsolve(sys);
 (1)
 >

Download pdeProb.mw

## Use '~', the elementwise operator...

as in

```restart;
m1 := Matrix([[x[0,0]=1,x[0,1]=1,x[0,2]=0,x[0,3]=0,x[0,4]=0,x[0,5]=0],
[x[1,0]=0,x[1,1]=0,x[1,2]=1,x[1,3]=1,x[1,4]=0,x[1,5]=0],
[x[2,0]=0,x[2,1]=0,x[2,2]=0,x[2,3]=0,x[2,4]=1,x[2,5]=1]
]
);
m2:=rhs~(m1);
```

## Requirement no completely clear...

but the attached *may* be what you want

 > expr:=u[1](T[1], T[2], T[3])=exp(T[1]*I); diff(expr, indets(rhs(expr),name)[]);
 (1)
 >

Download doDiff.mw

## One way...

The method shown in the attached is pretty 'ugly', but it seems to work

 > restart;   getOrd:= (f1, f2)-> max                       ( PDETools:-difforder                                   ( select                                     ( i-> has(i, diff(f2,t)),                                       convert                                       ( indets(f1, function),                                         list                                       )                                     )                                   )                       ):
 > f:= 2*y*(diff(x(t), t))^2+3*(diff(x(t), t\$3))-3*x*(diff(y(t), t));   getOrd(f, y(t));   getOrd(f, x(t));
 (1)
 >

Download getOrder.mw

## Probably several ways to do this...

some of which are probably more "elegant" than my attempt in the attached

 > restart;   plot3d( sin(x*y),           x = -2 .. 2,           y = -2 .. 2,           axes = framed,           colorscheme = [ "zgradient",                           ["Blue", "Green", "Yellow", "Red"]                         ]         );
 > doContour:= proc( nsteps::posint)                     local j;                     uses plots, ColorTools:                     return display                            ( [ seq                                ( implicitplot                                  ( sin(x*y)=-1+2*(j-1)/nsteps,                                    x = -2 .. 2,                                    y = -2 .. 2,                                    axes = framed,                                    color = WavelengthToColor                                            ( 450+(j-1)*(625-450)/nsteps,                                              method="linear"                                            ),                                    if   type(j, odd)                                    then legend=(-1+2*(j-1)/nsteps)                                    else NULL                                    fi,                                    scaling=constrained,                                    size=[800,800]                                  ),                                  j = 1..nsteps+1                                )                              ]                            );               end proc:  doContour(10);  doContour(20);  doContour(100);
 >
 >
 >

Download conPlot.mw

## Format...

of your animate() command is a bit "unusual". In fact I was mildly urprsed that it "worked" at all!

If I convert it to follow the standard technique explained in the "help", then the line properties appear to be retained. See the attached

 > with(plots): A := animate( plot,               [ X+t,                 X = -10 .. 10,                 color = red,                 linestyle = dash               ],               t = -10 .. 10             ): B := animate( plot,               [ t^2+X,                 X = -10 .. 10,                 color = blue,                 linestyle = solid               ],               t = -10 .. 10             ): display([A, B]);
 >

Download doAnim.mw

## So many things to fix...

that it is impossible to list them all.

And so many that it is also impossible (for me at least) to figure out what you actually want.

See the attached for details of basix syntax (and other) problems. Be aware I got bored and stopped identifying errors about half way through your worksheet

 >
 >
 >
 >
 >
 >
 >

Download corrections.mw

## A fundamental problem...

Outputting solution values to a file (or multiple files) is trivial.

However I'm not going to show how to do this because I have conerns over the validity of any generated numerical values.

Consider very carefully your boundary conditions

cond:= {u(0,t)=sin(.5*Pi), u(x,0)=0}

The first condition states that                u(0,0)=sin(0.5*Pi)=1.
The second condition states that          u(0,0)=0

So what do you want u(0,0) to be? Produce consistent  boundary conditions accordingly

 First 6 7 8 9 10 11 12 Last Page 8 of 112
﻿