## Steepest Descent Method...

Hello, My name is Kostas and I am new in the forum. I am new in Matlab as well. I am trying to get some advice in executing a code that I found on a book "Numerical Methods using Matlab". The code is as follows: function [xo,fo] = opt_steep(f,x0,TolX,TolFun,alpha0,MaxIter) % minimize the function f by the steepest descent method. %input: f = ftn to be given as a string ’f’ % x0 = the initial guess of the solution %output: x0 = the minimum point reached % f0 = f(x(0)) if nargin < 6, MaxIter = 100; end %maximum # of iteration if nargin < 5, alpha0 = 10; end %initial step size if nargin < 4, TolFun = 1e-8; end %|f(x)| < TolFun wanted

## lists...

How do I append lists? An example is a1:=[1,2,3]; a2:=[4,5,6]; Desired result is [1,2,3,4,5,6]. Now I a3:=[seq(a1[i],i=1..3),seq(a2[i],i=1..3)]; That is not very elegant. Also how do I find the dimension of a list? Like dimension(a1); 3

## How do I find where to lines intersect?...

Hi again people, I have just another little quick question and that is if I graph two polynomial functions on an interval is there a way to find where the two polynomial intersect each other? Can it be done without graphing? Again I need accuracy to 3 decimal places. Thanks again.

## How do I get maple to do a higer order derivative?...

Hi people, I am actually taking a maple practice test and am wondering how would I go about doing a higher order derivative of this function. f(x) = sin(x^2/(x^10+2))*e^(2*x) I would like to find the 8th deriavtive at x = 0 to 3 decimal places. The answer is 112.000 but i would still like to know how to solve it as in the real test there will be one just like it. If someone could give the algorithm that i would put it in that would be great. Used the help feature but it was not all that helpful. Thanks in advance. Tabish

## Trivial question

by: Maple
I'm sorry, this seems like such a trivial question, but how do I input information into Maple on different lines without executing the execution group? For example: Rather than [> EntryGenerators[Add]("NumDigits",[["5", [5]],["10", [10]],["20", [20]],["50", [50]],["100",[100]]]); I would like to enter it as [> EntryGenerators[Add]( "NumDigits", [["5", [5]], ["10", [10]], ["20", [20]], ["50", [50]], ["100", [100]]]); But I can't seem to get a new input line without executing the group. Any help here would be greatly appreciated! Thanks, Joe

## Maple is not recognizing greek-alphanumeric symbol...

Before I upgraded, I would input Δx:=2 and Δx would be a single variable. Now I input Δx:=2 and I get "Error, illegal use of an object as a name" If I input Δx [enter] it returns Δ x as though they are multiplied. How do I input greek-alpha combo variables again? Thanks for any help. BE

## solving equations for constants

by: Maple
Hi, I have an equation p*V/(W+V) - q*S = 0 where W,p,q are nonnegative constants and V,S are positive constants i.e. definitely not zero! I want Maple (10) to output p > q*S to show that this is the condition for the main equation to hold. How can i do this??? cheers gillersuk p.s. I have > assume(0 <><><><><><> constants := constants, (S, V); at the start of my document to define my assumptions and my constants. Perhaps this is why i'm having problems?

## Restrictions of parameters fit ??...

Hi, I have a problem with fit parameters restrictions. I would like to give restrictions of the parameters of my fit in order to get the best fit parameters, but the "parameterranges" seems to be not in function. my function is following: > y1 := piecewise(0 <><>

## Writing ODEs in text...

I'm trying to write a document in Maple 10 that includes some ODEs. I want these to be either text or math inputted in the form dV/dt = V [f(S)-r] (where V is a function depending on t and f is a function dependent on S that I want to introduce later in the document). It would be good if they could be inputted in math form so that they have labels but ideally i want them in a clear non-Maple form like above rather than somthing like V'(x)= V(x)*[f(S) - r] which is what I keep getting (or other similar things like it including Maple solving V'(t) and outputting zero which is not at all what i need)

## Sparse Matrix-Vector product using evaluation

by: Maple

This tip comes care of Dr. Michael Monagan at Simon Fraser University. Represent your sparse matrix as a list of rows, and represent each row as a linear equation in an indexed name. For example:

A := [[1,0,3],[2,0,0],[0,4,5]];

S := [ 1*x[1] + 3*x[3], 2*x[1], 4*x[2]+5*x[3] ];

To compute the product of the matrix A with a Vector X, assign x[i] := V[i] and evaluate. This can be done inside of a procedure because x is a table.

V := [7,8,9]: for i to 3 do x[i...

## subs issue....

I am trying to use the subs command to take a general solution to a differential equation and apply some numerical values. I can't seem to get the system to recognize the values I am substituting for. Consider the following: m*diff(y(t),t,t)=-m*g+sigma*A*diff(y(t),t); (1) y(0)=h,D(y)(0)=0; (2) dsolve( {(1),(2)} ); (3) subs( {A=2,m=50},rhs((3)) ); Everything works fine. If, on the other hand I impose any kind of constraint on A or m in the original equation then the substitution fails (nothing happens). Clearly the system has tagged the value for A and m as something other than their original name. Since the system doesn't report this name change how can I make substitutions after a symbolic manipulation like this?

## Have a 2d plot of a 3 variable polynomial?...

Hi, I'm new to Maple so please forgive me if this seems really easy but I can't seem to find it in help anywhere. Basically, I have an equation that is a function of x, y, and t (where t is time). Instead of a 3-D plot, I would like to display a 2-D plot with x-axis and y-axis and have 5 lines of the equation at various intervals of t (t=0, t=1, t=3, t=5, t=20, etc.). Thank you very much for the help, KC