5565 Reputation

17 Badges

10 years, 1 days

MaplePrimes Activity

These are answers submitted by tomleslie

# Starting with the equation
  H := 1/(2*m)*diff(f(q,P,t), q)^2 = -diff(f(q,P,t),t);
# Make the substitution
#   f(q,P,t) = f1(q) + f2(t)
# in H and reassign the output to H
  H:=subs( f(q,P,t) = f1(q) + f2(t), H);
# Set both sides of this equation to the same
# constant and treat as a set of two differntial
# equations - and solve this ODE system
# Select the positive solution and compute
# the combination f1+f2
# perform the requested differentiations

Like the manual says.

The ShowSolution command is used to show the solution steps for a Calculus1 problem, that is, a limit, differentiation or integration problem such as can be expected to be encountered in a single-variable calculus course.

so it may not be appropriate for "polynomial factoring questions and linear equation questions":-(

The second problem you might have using it, is that you have to ensure that you are preventing Maple from doing its automatic simplification: so for example

Student[Calculus1][ShowSolution]( diff(x^2*sin(x),x));

will produce an error, because the argument will be simplified (ie the diffentiation will be carried out) before being presented to ShowSolution(). This can be avoided by using uneval quotes, which postpones the simplification, so

Student[Calculus1][ShowSolution]( 'diff(x^2*sin(x),x)');

will produce a step-by-step output

For "polynomial factoring questions and linear equation questions" it may be better to take a look at the commands

Student[Basics][ExpandSteps] (), and


The first of these show the step-by-step guide to "simplifying" expressions involving polynomials. As an example, consider the difference between the outputs to the following two commands

Student[Basics][ExpandSteps]( (a^2-1)/(a/3+1/3) );

The second command shows the steps involved in "solving" an equation for a variable (provided that the equation s linear in the desired variable). As an example of the second, consider the difference between the outputs to the following two commands

solve( (x+1)/(2*y*z) = 4*y^2/z + 3*x/y, x );
Student[Basics][LinearSolveSteps]( (x+1)/(2*y*z) = 4*y^2/z + 3*x/y, x );



Depending on several factors such as,

your browser

the Maple interface you are using (1-D math, 2-D math, whatever)

the results of attempting a cut/paste operation can be pretty variable.

One thing which pretty much always works is to

create a Maple worksheet

upload that worksheet, using the big green up-arrow icon in the MaplePrimes entry window


Most of this question seems to have gone missing, but something like the following will perform the basic function of plotting a function, and then plotting secants from a given anchot point

   f:=x->x^3-x^2-4*x+10: # define the function
   p1:=[0, f(0)]: # the "anchor" point
   p2:=[4, f(4)]: # furthest point for which the secant is requred
# generate a sequence of plots comprising the graph of the function
# combined with a secant

   l1:= [ seq
            ( display( [ f1, line( p1, [t,f(t)],
               t = p2[1]..p1[1], -1/10
# display the sequence of secants
    display(l1, insequence=true);

Your original code finds a numeric soltuion for the differential equation, for any supplied value of the parameter A. However you wish to specify that with theta=5/1000, determine a value for A, which makes r(theta) as close as possible to 10000 - at least that is how I understand the question.

Essentially this is an optimisation problem: if you think of r(theta), as also depending on the value of A, so very loosely, one could write it as r(theta, A), then you are looking for the situation where (with theta=5/1000)

( r(5/1000, A) -10000 )^2

is minimised - (you want it to be zero)

The issue then becomes one of defining a suitable target function for the optimisation and using NLPSolve to provide the answer (Probably could have used DirectSearch - but I didn't, cos NLPSolve worked)

See the attached code, (excuse the 1-D math input - I'm a bit old-fashioned)

which takes about 5sec on my machine to produce the answer.


More (or fewer) digits could be obtained by fiddling with the Digits setting in the worksheet



subs(_C1=A, dsolve(ode));

I'm assumiing your correction was meant  to be y'(0)=8.1

Couldn't get a symbolic solution (didn't try really hard), but if a numeric solution is acceptable then

eqs:= diff(x(t),t,t)=-0.02*sqrt(diff(x(t),t)^2+diff(y(t),t)^2)+diff(x(t),t),
bcs:= x(0)=0,
sol:= dsolve( {eqs, bcs},
plots[odeplot]( sol, [[t,x(t)],[t,y(t)]] , 0..2);

seems to work

Contents of matrices will not be saved between Maple sessions. They have to be regenerated for each session. (or you could use ExportMatrix/ImportMatrix)

If I use


everything seems to work.

If you don't understand why, then I suggest you read the algsubs() help page very carefully, along with consideration of the following "trivial" examples

sub2:=subs(x=a, eqn)

I have no problem with RLopez explanation: so far as I can tell, it is completely correct.

However my original response has the unnecessary complication of trying to use the polar() representation of complex numbers: I have subsequently decided that this was a little pointless. Maple does complex arithmetic using the "cartesian" form (ie a+I*b) of complex numbers, so using the "polar" form doesn't really gain anything.

I also should have made clearer the fact that engineers like their angles in degrees and mathematicians (and Maple) like their angles in radians. So skipping the polar() form and making the degrees->radians and radians->degrees transformations somewhat more explicit (and without having to define conversion factors) your original problem can also be solved with

# Initialise
# (r, theta) represemts a complex number in terms of
# magnitude, phase (in degrees). In order to convert
# this to a complex number on which Maple can do sums
# it need to be converted to the form x+I*y, where
# x = r * cos(theta)
# y = r * sin(theta)
# with the (slight) added complication that you
# want to enter angles in degrees (cos engineers do)
# and Maple wants angles in radians (cos mathematicians
# do). So the following takes a representation r, theta
# (in degrees), converts the latter to radians and then
# returns a complex number in "Cartesian" form, ie x+I*y
   phasor:= (r, theta) -> r*cos(convert(theta*degrees, radians))
                                    I*r*sin(convert(theta*degrees, radians)):
# So now we can try a few easy-to-verify examples of
# what the phasor function actually does - just remember
# that the arguments are magnitude and phase (in degrees)
# and the outputs are the "cartesian" form x+I*y of the
# same complex number
# Just for example purposes - no bearing on the subsequent
# calculation
   c2:=phasor(1, 45);
   c3:=phasor(1, 90);
   c4:=phasor(1, 135);
   c5:=phasor(1, 180);
# Either of the following will perform the requisite calculation
# The only difference is that the first of these will not
# necessarily be "simplified" to the form a+I*b, whereas the
# additiona of the evalc() wrapper will ensure this simplification
   sol1:= phasor(200, 0)/( phasor(100, 45)+phasor(100, 45) ):
   sol2:= evalc(phasor(200, 0)/( phasor(100, 45)+phasor(100, 45) )):
# However using abs() and argument() functions will force
# the necessary simplification and either will return the
# magnitude and phase: although phase will be in radians, so
# again one needs to do a conversion to get back to degrees
   abs(sol1), convert(argument(sol1), degrees);
   abs(sol1), convert(argument(sol1), degrees);

system2hD := 0 = -d[1, 2],
                     0 = -d[2, 1],
                     0 = -delta*d[1, 2],
                     0 = -d[1, 1]-delta*d[1, 1],
                     0 = -delta*d[1, 1]-d[2, 2];
solve({system2hD}, {d[1, 1], d[1, 2], d[2, 1], d[2, 2], delta});

One possibility, following the "spirit" of electrical calculation with phasors, would be

cf:= 2.0*Pi/360:
phasor:= (x,y)->polar( x, y*cf ):
sol:= evalc( phasor(200,0)/( phasor(100,45)+phasor(100,45) ) ):
abs(sol), argument(sol)/cf;

Try the following

If you can't be bothered to check for previous solutions, try

combinat:-permute( [0$3,1$3], 3);

You could type

for variableName from val1 by val2 to val3 do

at the start of the worksheet, followed by

end do

at the end of the worksheet.

Have I missed somethig???

First 111 112 113 114 115 116 117 Last Page 113 of 122