tomleslie

13876 Reputation

20 Badges

15 years, 176 days

MaplePrimes Activity


These are answers submitted by tomleslie

Strange things about the answer provided by Kitonum are

  1. that the 'y-value' never decreases
  2. the x-value seems rather constrained - I would expect it to "wander" further
  3. Ask yourself the question -why does the x-value vary over such a small range, while the y-value varies over such a large (albeit positive - so probably wrong) range.

Attached is my solution. Generate a new 'walk' just by re-executing the complete worksheet using the '!!!' from the toolbar (It's past my bedtime so I'll leave the clever animation for now - maybe tomorrow!)

randwalk.mw

 

because

  1.  the quantities EI, F15, Fe, Jl, Jr, Le, Lm, beta, ml, mr, omega, sl, sr are undefined (in either Maple or EXCEL)
  2. the functions sen() and senh() are undefined in either Maple or EXCEL - maybe should be sin() and sinh() ?

Either increase Digits setting, as in

restart;
Digits:=20;
f:=10000/(1+30762*0.478^x)+5;
maximize(diff(f,x));
diff(f,x)=maximize(diff(f,x));
isolate(%,x);

or use the 'location' option for the maximize() function, as in

restart;
f:=10000/(1+30762*0.478^x)+5;
maximize(diff(f,x), location)

 

By default the dsolve(numeric) command will not return explicit procedures for the highest order derivatives in the supplied ODE system.

If you need these, then the simplest way to do this is to add some "dummy" variables to your ODE system, and set these equal to the derivatives which you want, so in your case, you would need to add

A(t) = diff(x(t), t),
B(t) = diff(y(t),t),
C(t) = diff(z(t),t)

with these added to your ODE system, check out the following


 

restart;
with(plots):

wl:=0.08: alpha:=0.5: gamma0:=8.82*1e10: mu0:=4*Pi*1e-7:
gammA:=gamma0/(1+alpha^2): alphaPrime:=mu0*gammA*alpha:
gamma1:=mu0*gammA: m0:=mu0*1e5: num:=[seq](i,i=1e2..1e4):

w:=num[1]:
dsys:= { diff(x(t), t) = alphaPrime*(z(t)^2*wl*cos(w*t)/gamma1+y(t)^2*wl*cos(w*t)/gamma1),
         diff(y(t),t) = -z(t)*wl*cos(w*t)-alphaPrime*y(t)*wl*cos(w*t)*x(t)/gamma1,
         diff(z(t),t) = y(t)*wl*cos(w*t)-alphaPrime*z(t)*wl*cos(w*t)*x(t)/gamma1,
         A(t) = diff(x(t), t),
         B(t) = diff(y(t),t),
         C(t) = diff(z(t),t),
         x(0) = .01,
         y(0) = 1,
         z(0) = 0.1
       }:
ans:=dsolve(dsys,numeric):

odeplot( ans,
        [ [t, A(t)],
          [t, B(t)],
          [t, C(t)]
        ],
         t=0..1,
         color=[red, blue, green],
         legend=["diff(x(t), t)",
                 "diff(y(t), t)",
                 "diff(z(t), t)"
                ],
         legendstyle=[font=[times, bold, 20]],
         numpoints=10000
       );

 

 

``


 

Download odeProb.mw

 

 

Leaving aside the issue of how how to include the function T(x) in your 'second' ODE system, you should be aware that Maple cannot calculate a meaningful answer for your 'first' ODE system. Examine the output of

restart;
with(plots):
R0:= 10^(-5): C:= 1: m:= 1/100: u1:= 1000:
sys1 := R(x) = 2*(-r(x)*diff(r(x), x)*cos(x)+r(x)^2*sin(x)+diff(r(x), x)^2*sin(x)-sin(x)*r(x)*diff(r(x), x$2))/(r(x)^4*sin(x)),
        diff(R(x), x$2)+cot(x)*diff(R(x), x) = -(1/2)*r(x)^2*(R0^2-R(x)^2);
cond := R(Pi) = 1/500^2, r(Pi) = 500, (D(R))(Pi) = 0, (D(r))(Pi) = 0:
F1 := dsolve({cond, sys1}, numeric, output = listprocedure, maxstep=1.0e-05):
odeplot(F1, [x, r(x)], x=0..Pi);
odeplot(F1, [x, r(x)], x=Pi..2*Pi);

The two plot commands will fail within about 0.05 of the intial point, x=Pi. If you increase the value of the 'maxstep' option then you can apparently get further from the intial point before failing, but the values generated are almost certainly incorrect.

Reducing maxstep allows you to isolate a singularity. In your ODE system there appears to be a singularity at the initial point x=PI, probably arising form the existence of cot(x) in the second equation - becuase cot(Pi) is undefined.

Since your first ODE system cannot be solved, there is no prospect of using any 'results' from this in your second ODE system.

Using your "toy" example, check the output of the getdata() command

p1 := plot( 2*x+1,x=0..4,numpoints=9);
plottools:-getdata(p1);

This will always contain one (or more - consider multiple curves in the same plot) matrices of the points being plotted. But you can pretty much always extract the data being plotted.

Notice that because Maple generates more plotting points when a curve is changing "rapidly", you should never assume that points in the matrix are equally spaced

 

the attached, which works for me.

MOLprob.mw

You state that you started by defining

p:= ln(1+x)*y) + e^((x^2)*(y^2)) - x - cos(x)

Now look at this expression carefully.

For example

  1. in the first term you have two closing parentheses - ie the character ')', but only one opening parenthesis - ie the character '('. You cannot have two closing parnetheses - ')' unless they are preceded by two opening parentheses. This is syntactic nonsense.
  2. In the second term e^((x^2)*(y^2)), do you mean exp((x^2)*(y^2))? If not, what is 'e'?

Markiyan is correct, in that the easiest way is to use Maple's inttrans package.

However if you want to calculate the Fourier coefficients yourself (eg for learning purposes, then the simplest way is probably

  restart;
  assume(T>0):
  fn:=piecewise( t>-T and t<0, 1+t/T,
                            t>=0 and t<T, 1-t/T
                         );
#  plot( eval(fn, T=1/2), t=-2..2);
  int((1+t/T)*exp(-I*w*t), t = -T.. 0)+int((1-t/T)*exp(-I*w*t), t = 0 .. T);
  simplify(expand(convert(%,trig)));
#
# Do half angle transformation
#
  subs( cos(w*T)=1-2*sin(w*T/2)^2, %);

 

Assuming that you can create some kind of plot in Maple that you have a wide variety of 'export' options using the command exportplot(), which supports the graphics formats GIF, JPEG, TIFF, BYU, DXF, COLLADA, JVX, OBJ, OFF, PLY, POV, STL, VTK, WMF

Now which one of these graphics formats do you want to use?

 

 

 

Maybe you want something like

restart:
Sn:=n -> evalf
                ( add
                   ( (1/k^(1/10))*sin(1/k),
                     k=1..n
                   )
               );
seq( Sn(10^p),
         p=1..5
      );

On my machine this takes about 5secs to run - so just wait!

If this isn't what you want then try to be more clear

 

  1. You seem to be using x__k(t) and x[k](t) with k=1..18 more or less interchangeably. In Maple x__1(t) and x[1](t) are two different functions.
  2. You are using several undefined functions - 'sind()', 'cosd()', 'atan2()', u(). I could probably make an educated guess for the first three, but the use of u(1) and u(2) in the assignments to 'icdref' and 'icqref' have got me puzzled - something to do with u__1(t) and u__2(t) maybe?

is the use of square brackets ( ie '[]') in a simple mathematical expression. In Maple, square brackets are only used with indexable quantities such as lists, matrices, arrays, etc. You cannot use these just to "group" terms in a "simple" mathematical expression. If I fix this, perform a Taylor expansion about x=0 (NB you do not specify the expansion point), select the coefficients of the terms x^3, x^4, x^5, x^6, then solve for a,b,c,d which sets these coefficients to zero, then I end up with [a = 0, b = 16/15, c = 0, d = 2/5].

See the attached


 

  restart:
#
# Fix the parenthesis issue and define the expression
#
  y:=(1+a*x+b*x^2)/(1+c*x+d*x^2)*ln(sinh(x)^2 + cosh(x)^2);
#
# generate a Taylor series for this expression, expanded
# about the point x=0 (NB: OP does not specify the
# expansion point so I'm guessing)
#
  p:=convert(taylor(y, x=0, 9),polynom);
#
# Get the coefficents for x^3..x^6
#
  gC:=coeffs(p, x)[2..5];
#
# Require that each of these coefficients be zero
#
  sol:=solve([%], [a,b,c,d])[];

(b*x^2+a*x+1)*ln(sinh(x)^2+cosh(x)^2)/(d*x^2+c*x+1)

 

2*x^2+(2*a-2*c)*x^3+(-4/3+2*b-2*d+2*(-a+c)*c)*x^4+(-(4/3)*a+(4/3)*c+2*(-a+c)*d+2*(a*c-c^2-b+d)*c)*x^5+(64/45-(4/3)*b+(4/3)*d-(4/3)*(-a+c)*c+2*(a*c-c^2-b+d)*d+2*(-a*c^2+c^3+a*d+b*c-2*c*d)*c)*x^6+((64/45)*a-(64/45)*c-(4/3)*(-a+c)*d-(4/3)*(a*c-c^2-b+d)*c+2*(-a*c^2+c^3+a*d+b*c-2*c*d)*d+2*(a*c^3-c^4-2*a*c*d-b*c^2+3*c^2*d+b*d-d^2)*c)*x^7+(-544/315+(64/45)*b-(64/45)*d+(64/45)*(-a+c)*c-(4/3)*(a*c-c^2-b+d)*d-(4/3)*(-a*c^2+c^3+a*d+b*c-2*c*d)*c+2*(a*c^3-c^4-2*a*c*d-b*c^2+3*c^2*d+b*d-d^2)*d+2*(-a*c^4+c^5+3*a*c^2*d+b*c^3-4*c^3*d-a*d^2-2*b*c*d+3*c*d^2)*c)*x^8

 

2*a-2*c, -4/3+2*b-2*d+2*(-a+c)*c, -(4/3)*a+(4/3)*c+2*(-a+c)*d+2*(a*c-c^2-b+d)*c, 64/45-(4/3)*b+(4/3)*d-(4/3)*(-a+c)*c+2*(a*c-c^2-b+d)*d+2*(-a*c^2+c^3+a*d+b*c-2*c*d)*c

 

[a = 0, b = 16/15, c = 0, d = 2/5]

(1)

#
# Having obtained this solution, and as a double-check,
# substitute these value in the original expression
#
  y2:=subs(sol, y);
#
# Now generate the "same" Taylor series as before. Note
# that no powers of x^3, x^4, x^5, x^6 exist
#
  p2:=convert(taylor(y2, x=0, 9),polynom);

((16/15)*x^2+1)*ln(sinh(x)^2+cosh(x)^2)/((2/5)*x^2+1)

 

2*x^2-(992/4725)*x^8

(2)

 


 

Download gCoeffs.mw

 

There is a pretty standard process to go through to solve Laplace's equation - although it does involve some assumptions (such as separability), and introduces a further constant (which means that four boundary conditions may not be enough to generate an explicit solution)

The basic process is illusatreted in the attached

 

I simply don't understand this option

events=[[[x(t)=0, v(t)<0], [x(t)=0, v(t)=0]], [x(t)-CMAX, halt]]

on a couple of grounds. Specification of events should take the form

events=[ [trigger1, action1], [trigger2, action2], [trigger3, action3] ]

ie a "simple" list of lists - but the first entry in your 'events' specification is itself a list of lists, so your 'events' specification is a list of lists of lists - one too many nested lists!?

Second thing I don't get is the [x(t)=0, v(t)<0] entry; the first argument as a 'trigger' is OK, but the second argument is not a sensible action - how am I supposed to interpret this?

If I replace your 'events' option with the simpler

events=[[x(t)=0, v(t)=0], [x(t)-CMAX, halt]]

which has correct syntax, as well as sensible 'triggers' and 'actions' then your code executes with no errors. Of course I may be missing some event which you are trying to trap

First 148 149 150 151 152 153 154 Last Page 150 of 207