Useful commands:
a small exercise by Ryan Renn
The following commands can be time savers. The goal here is to save you time from your computational dirty work. To get a feel for these symbolic commands, enter the commands listed below and see what they do:
Maple commands
- Function Definition
> f(x):=x->C*x^n;
(This defines a function, f(x) = C* x^n.)- Function Evaluation
> f(2);
> f(t);- Symbolic derivatives
> diff(x^2,x);
> diff(diff(f(x),x),x);- Symbolic integrals
> int(f(t),t);- Solve
> solve(x+2=4,x);
> solve(cos(x)=0,x);- Hideous integrals
> int(cosh(x)^400,x);Matlab commands
- Function Definition
>> a='C*x^n'
(Different from Maple.)- Substitution
>> subs(a,'t')
>> subs(a,2)- Symbolic derivatives
>> diff('x^2','x')
>> diff(diff(a,'x'),'x')- "Pretty" code
I feel that the output for the last statement is repugnant. Try
>> pretty(diff(diff(a,'x'),'x'))- Factor
This is better, but not quite satisfying. Try
>> pretty(factor(diff(diff(a,'x'),'x')))- Symbolic integrals
>> int(a,'x')- Solve
>> solve('x+2=4','x')- Running Maple commands through Matlab
You are on a computer that runs Matlab, but alas, it doesn't run Maple. But you are crafty, and aware of Matlab's "maple" command:
>> maple('expand((x+2)^5)')
Try also
>> maple('y:=t->A*cos(.5*t)+B*sin(.5*t)+C*t*cos(.5*t)+D*t*sin(.5*t);')
>> maple('diff(diff(y(t),t),t)+.25*y(t);')
e-mail: renn@purdue.edu |