tomleslie

5348 Reputation

15 Badges

9 years, 279 days

MaplePrimes Activity


These are answers submitted by tomleslie

There are lots and lots of very clever ways to make information/procedures/data etc available across multiple worksheets, but I am assuming that you want the simplest, which (I think) is

  1. understandable
  2. works

I have tried to keep the following as simple as possible - sophistication can come later!!!

Suppose you define a procedure to produce the square of its supplied argument, then you can define and save this procedure with the following code sequence

dosq:= proc( x)
                  return x*x;
           end proc;
save dosq, "C:/Users/TomLeslie/dosq.mpl";

In any new worksheet you can load this procedure with

read "C:/Users/TomLeslie/dosq.mpl";

and execute in the new worksheet with (for example)

dosq(4);

which ought to return 16

Note that where I use the path "C:/Users/TomLeslie/", you should use something appropriate for your machine, and where you want ro store your Maple procedures - If you have a single-disk machine then

"C:/Users/yourUserName/myMaple/dosq.mpl"

would be a reasonable choice

You make the statement

The collect command is supposed to rewrite the expression in terms of the variable descending order.

This is incorrect. The help page for the collect command states quite clearly (my highlighting)

The collect function views a as a general polynomial in x.  It collects all the coefficients with the same rational power of x.  This includes positive and negative powers, and fractional powers.  Note that the resulting expression is not necessarily sorted by powers of x.

As the help page for the collect command clearly states

To sort a polynomial see the sort function.

So try the following

p := expand((a^2+2*x)*(a^2+2*x));
collect(p,x);
sort(p,x);

to see the difference. Note that, for more complicated expressions

sort( collect(p, x), x)

may be useful

 

a1 := Matrix(3, [1, 2, 3, 7, 8, 9, 13, 14, 15]);
a2 := Matrix(3, 2, [5, 6, 11, 12, 17, 18]);
a3 := Matrix(2, [19, 20, 25, 26]);
a4 := Matrix(3, 2, [5, 6, 11, 12, 17, 18]);
A := eval(Matrix(2, 2, ['a1', 'a2', 'a3', 'a4']));

Seems to be a lot of confusion for such a simple problem?!?!

Simply execute either of the following code snippets to get the answer you want

restart;
with(Student[Calculus1]):
evalf(Tangent(-ln(x)+exp(x), x=2));


or

restart;
with(Student[Calculus1]):
f:=x->-ln(x)+exp(x):
evalf(Tangent(f(x), x=2));

and read the help page for Student[Calculus1])[Tangent] to understand why both/either work.

If you really want only three significant figures, then modify the above, using a second argument to the evalf() command, to

restart;
with(Student[Calculus1]):
evalf(Tangent(-ln(x)+exp(x), x=2), 3);

and

restart;
with(Student[Calculus1]):
f:=x->-ln(x)+exp(x):
evalf(Tangent(f(x), x=2), 3);

I mean, how hard can this be??????

You got really unlucky!!

There seem to be two commands for plotting a space curve (whihc surprised me!!

  1. plots[spacecurve]( [list of components], range=whatever )
  2. Student[VectorCalculus][SpaceCurve](<cos(t),sin(t),t>,t=1..5,axes=framed)

Note the differences in capitalisation of the term spacecurve between these two, and lso the fact that the first takes a list of components eg [cos(t), sin(t), t] and the second takes a vector of components <cos(t), sin(t), t>

You seem to have used the first of these - ie plots[spacecurve] but with the vector form for the corrdinates rather than the list!!

See that attached for both ways

scurve.mw

It seems as if the default axes and colour option for these two commands are different

For future reference you can upload worksheets using the big green up-arrow in the toolbar.

Several syntax errors, and usages of deprecated structures,so  that I have difficulty working out what you actually want. Whilst making the minimum(?) number of changes to your original code, the following produces something - which may (or may not be) what you want.

filt.mw

Your code seems for complicated for what you are trying to achieve, but since I don't actually understand what you are trying to achieve.....

Go to Tools->Options->Display and set input display to Maple Notation,

followed by Apply to Session or Apply Globally

I think you have a problem with parentheses - your plot range 0..100 is included in a ist with functions to be plotted becuase of the positioning of your square brackets. The following is a trivial example of two plots, which does work

X2:=t->t^2;
Y2:=t->t^2-3*t;
plot([Y2(t),-X2(t)], t=0...100, numpoints=100);

  1. You have missed the multiplication sign between 'p' and '(4x2+6)' - one of the perils of using 2D math input is that this sort of thing is difficult to spot
  2. Once you correct the above, your loop will only return non-zero values for n=1, because your 'polynomial' only contains terms in p^1

see attached

HPM_4corr.mw

eq:=m*diff(x(t),t,t)=-k*x(t)-b*diff(x(t),t);
dsolve(eq, x(t));

cos it works for me

Try this

profit.mw

 

@krismalo 

Using default (ie cubic) spline curve fitting, the following works

  restart;
  with(CurveFitting):
  xlist:= [150, 250, 500, 800, 1300, 2500, 5000]:
  ylist:= [.3, .5, .8, 1.0, 1.2, 1.4, 1.6]:
#
# Define a function to retiurn y-value for given x
#
  gety:= unapply( Spline([seq([xlist[j], ylist[j]], j=1..7)], x), x):
#
# Define a function to retiurn x-value for given y
#
  getx:= unapply( Spline([seq([ylist[j], xlist[j]], j=1..7)], y), y):
#
# Compute the y-value for say x=3000
#
  gety(3000);
#
# Check that previous result corresponds to the supplied x-value
# (near enough!)
#
  getx(%);

Not sure I understand the problem - if I change your final command to

CodeTools:-Usage( plot([f1,u21], 0..10, adaptive=false, axes=none, numpoints=200,labels=[x,u],legend=["t=0","t=0.2"],color=[green,red]) )

then two curves are plotted -one of which shows that your "double integral" is more or less identically zero.

So what exactly is your issue???

the variable Et whose entries you wish to solve for may seem to be a column vector, but is actually a matrix - so Et[1] returns the first 'row' of the matrix as a vector. If you want the first entry, you need to use Et[1][1].

ie

solve(Et[1][1], Q[1])

returns -36949.67738  

plot( sum(0.5^(n), n=1..x), x=0..10 );

First 108 109 110 111 112 113 114 Last Page 110 of 118