tomleslie

6252 Reputation

17 Badges

10 years, 111 days

MaplePrimes Activity


These are answers submitted by tomleslie

the attached should provide the plot you want. NB you will have to wait a few seconds because ones has to solve the ODE system, for each value of epsilon

helpSol.mw

In a plot of this type I would usually start with a simple approach such as coloring by z-value. You can get a straightforward linear hue variation by using the option

colorscheme = ["zcoloring",z->z]

although for your spectrogram this didn't produce a lot more detail than your 'valuesplit' approach. SO I tried to "compress" the z-values by changing the color function to

colorscheme = ["zcoloring",z->signum(z)*ln(abs(z))]

This was a little better - produced a bit more color variation.

The problem with the 'valuesplit' approach is that it assigns the same color to a range of z-values. I think it is generally better to use a continuous function of z-value. However picking the "best" continuous function is a bit of an experimental science!

The attached shows one way to achieve this. Output is in the form a matrix; first three columns step through specified values of a,b,c; fourth column is the value of your expression

odeExpr.mw

I'm a bit of a beginner with the physics package, but the following *seems* to set up what you want. (NB my choice of the Minkowski metric was arbitrary - I just needed to use something as a test case)

  restart;
  with(Physics):
#
# When using spherical polars, then dimension
# should be 4??? cos 'time' is always required?
#
  Setup(mathematicalnotation = true, dimension = 4);
  Setup(coordinatesystems = spherical);
#
# Define Minkowksi metric in spherical polars (just
# as an example)
#
  Msph := -d_(r)^2-r^2*d_(theta)^2-r^2*sin(theta)^2*d_(phi)^2+d_(c*t)^2;
#
# And set it as the metric
#
  Setup(metric = Msph);

 

the simple answer for your problem is to use

d:=diff( cos(x)*exp(y),y);
d1:=diff( cos(x)*exp(y),x);
d2:=diff(x^2+y^2, y);
d2:=diff(x^2+y^2, x);

However I do recommend that you get you head around the how Maple interprets the difference beween exp(1) and e^1. A hint: the latter produces an italic 'e' as output; the former produces a non-italic 'e' as output. The difference is significant!!

fsolve({E1, E2, E3}, {x, y, z})

(ie no restrictions on the variables) returns

{x = 27.89539427+.9225609210*I, y = -374.1524808-12.37403042*I, z = -71.10976328-2.351753413*I}

You have some kind of problem with this solution??

If you mean the how 'pretty' the graph is or how well it matches the image at the top of your worksheet, then I thinnk you have to use the setVertexPositions() command. See the attached, where I revised your first DrawGraph() command. Didn't really understand what you wee trying to do after this point so I haven't changed anything subsequently

prettyGraph.mw

Haven't used it much before, but it seems to do everything you have asked for. The attached computes triangle areas, lengths of altitudes, center and radius of circumcircle. It also plots most of the objects involved.

funWithTriangles.mw

The attached executes and produces graphs. Most of the typos I fixed were related to the use of '{}' or '[]', when you should be using '()'

odeSols.mw.

 

I agree with what has been posted earlier on the use of y'(t), D(y)(t) and diff(y(t),t). It seems as if using the last of these is mandatory (shouldn't be - but it is). However as a side-issue you should also be aware of the impact of selecting the number of steps - your code uses 'numsteps=5'.

It is informative to use the 'output=plot' option in the InitialValueProblem(), and compare the results when numsteps=5 and numsteps=100 (say), as in

restart:
with(Student[NumericalAnalysis]):
InitialValueProblem
( diff(y(t),t) = t*y(t)+1/y(t),
  y(0) = 3,
  t = 2,
  method = euler,
  numsteps = 5,
  output = plot
);
InitialValueProblem
( diff(y(t),t) = t*y(t)+1/y(t),
  y(0) = 3,
  t = 2,
  method = euler,
  numsteps = 100,
  output = plot
);

 

 
 

 

See the attached

Assuming that you mean the volume within the sphere but outside the cylinder, then I make it

(13/3)*Pi*sqrt(3)

The surface comes out at

8*Pi*sqrt(3)

sphTrunc.mw

See the attached, which essentially implements the following steps

  1. Your ODE system has a singularity at the left end-point, so default solution methods will not work
  2. One can circumvent this issue by using a midpoint method, although when I try this, the dsolve() process fails because complex values are being generated. Are you expecting that your system should generate complex answers??? If not then I would suggest that there is a typo either in your equations, or the boundary conditions.
  3. The first three of your equations do not depend on r(x) - so actually they form an IVP sub-problem. This sub-problem cannot be solved because the sytem is singular at the initial point. However if one defines the initial point as say 'eps' where this is small, but greater than zero (I used 1e-06), then this IVP sub-problem can be solved, and outputs generated for f(x), g(x), and h(x), over the range eps..5000. These get pretty huge! Are they plausible???

badODEsys.mw

Note that the first couple of lines in the help for the plot3d command states

plot3d(expr, x=a..b, y=c..d, opts)
plot3d(f, a..b, c..d, opts)

In the second of these 'f' is defined to be a procedure or operator. Note that when one has an operator, the plotting ranges are defined simply as a..b, c..d, rather than x=a..b, y=c..d

So using the Maple help, the following ought to work

p1 := proc (x, y)
         if x^2+y^2 <= 1
         then x*y-y^2
         else 0
         end if
         end proc;
plot3d(p1, -1 .. 1, -1 .. 1);

Guess what - it does

So why do you want to bother with uneval quotes?

Similarly, use of piecewise rather than if-then-else is pretty much a 'style' thing. I would probably do it in this case, but it doesn't really make a lot of difference. However using piecewise means that having a procedure is a bit superfluous, so

g:=piecewise(x^2+y^2 <= 1 ,x*y-y^2,0);
plot3d(g, x=-1 .. 1, y=-1 .. 1);

will produce the same answer: no procedures, no uneval quotes - what's not to like

  1. Only way I could reproduce OP's output was to make the assumption that n is a positive integer: NB:- OP does not indicate this requirement in his/her posted image
  2. However assuming that n is a positive integer, I tried n even, and n odd. As rlopez has already indicated, n even gives the integral to be identically zero. Furthermore n odd still does not reproduce tha value which OP claims is "the answer"

See the attached

badInt.mw

 

In the example you quote, you are using [] just to group terms: in maple [] are used to create indexable objects.

If I change your example by using () rather than [], I get the answer (1/840)*L

First 100 101 102 103 104 105 106 Last Page 102 of 132