## 118 Reputation

15 years, 326 days

## Seems to work quite well,...

Seems to work quite well, thanks

## Lagrange extreme value problem...

There's a typo in L: 2*x*z*2*y*z should read 2*x*z+2*y*z. And I added differentiation by z, so I got a suitable solution:

```with(RealDomain):
L:=(x,y,lambda)->x*y + 2*x*z + 2*y*z +lambda*(x*y*z-32);
solve(
{diff(L(x,y,lambda),z)=0, diff(L(x,y,lambda),x)=0, diff(L(x,y,lambda),y)=0,
diff(L(x,y,lambda),lambda)=0});
{x = 4, y = 4, lambda = -1, z = 2} ```

## Strange results...

On my Maple10 (both classic and standard) I get wrong determinants: for the default matrix [[1,-3],[1,2]] it should be 5 but says 4.

The reason: the line with tempMat[2,2] should be

tempMat[2, 2] := Maplets:-Tools:-Get('TB22'::algebraic, corrections);

## Nice solution...

My solution was to copy the content of a worksheet to Word but this needs a lot of editing time to bring it up to a small number of pages. In Maple 10 classic mode you can toggle the view of the group ranges, graphs, etc.
(The only thing is that in some plots the label of the x-axis is cut off.)

## contourplot x/t...

I suppose it is a problem with contourplot: the result changes a lot with different values for numpoints.

Here my suggestion:

```with(DEtools): ````display(implicitplot([seq](x/t=c/4,c=1..3),t=-10..10,x=-10..10,color=blue),DEplot(t*diff(x(t),t)-x(t)=0,x(t),t=-10..10,x(t)=-5..5));`

## PDE: Numeric approach...

```PDE:= diff(c(z,t),t) = k*diff(c(z,t),z\$2) + w*diff(c(z,t),z);
ics:={c(0,t)=0, k*D[1,1](c)(h,t) + w*D[1](c)(h,t)=0, c(z,0)=exp(-z^2)};#f(z)=exp(-z^2) just for testing```

The only symbolic solution to get is `pdsolve(PDE,HINT=a(z)*b(t));` but it doesn't work with the conditions.

But if you are only interested in a numeric solution here's how (see help page on pdsolve):
Please note that the range must be 0..h, so if h=1 Maple doesn't accept ranges like 0..0.5 or 0.1..2 for example

```sol:=pdsolve(eval(PDE,{k=1,w=.5}),eval(ics,{k=1,w=.5,h=1}),numeric,time=t,range=0..1);
p1:=sol:-plot(t=0,numpoints=50):
p2:=sol:-plot(t=1/8,numpoints=50,color=blue):
p3:=sol:-plot(t=1/4,numpoints=50,color=green):
plots[display]({p1,p2,p3});```

## Solving for eigenvectors step by step...

This was my first try: ``` K:=<<cos(theta)|sin(theta)*exp(-I*phi)>,<sin(theta)*exp(I*phi)|-cos(theta)>>; CP:=simplify(Determinant(K-lambda*IdentityMatrix(2))); ```
`		CP := lambda^2-1`
`l1,l2:=solve(%,lambda);      1, -1`
`map(lambda->LinearSolve(K-lambda*IdentityMatrix(2)),[l1,l2]);` and the output is [[-(cos(theta)+1)/sin(theta)], [-(cos(theta)-1)/sin(theta)]] and not the expected 2-dimensional Vectors... I suppose by giving c as result Maple means vectors either [1,c] or [c,1] - the problem is I don't know which one is the right one. I can't figure out how to make Maple print out the vectors. edit: the answer sqrt(1-c^2) is a good idea - but only for this certain problem as it doesn't work with other functions. It would be better to replace each different function by a different name and then re-evaluate them to the functions in the eigenvectors.

## creating and reading .mpl files...

With save f, "f.mpl"; a file f.mpl will be saved at your Maple installation folder, e. g. C:\Program Files\Maple 10. and not next to the open worksheet.

## Excel integration experience...

Just for fun I tested the tool (with Excel 2003 and Maple 10) and noticed two things: The first thing is: be careful if you change the warning/error message options to "Message" because you might have to click hundreds of times on the same small window saying there was an error - just because of some small spelling issue. I was evaluating points of an expression of t and just had mixed up x and t when it happened. The second thing is that Excel on a German platform needs to write commas instead of decimal points but Maple can't cope with that. Strangely, changing the decimal point behaviour in Excel doesn't help it: t+4 in D4, some floating number (e. g. =1/2 or 0.5) in D5 and then =maple("eval(&1,t=&2)";D4;D5) (which should work like eval(t+4,t=0.5) - and works with integers) produces "Error, invalid input: eval expects 1 or 2 arguments, but received 3" When I type 0.5 in D5 in the German decimal point setting, the Maple formula works but Excel can't calculate with D5 because it is considered as text.

## curry...

Consider the following example: ```f:=(u,v,w,x,y)->u^2+v^2+w*x+y: g:=(u,v,w,x,y)->u^7+v^4+w*x^2+y^2: h:=curry(f-g): h(u,v,w,x,y);``` u^2+v^2+w*x+y-u^7-v^4-w*x^2-y^2 This is much better than retyping all the arguments - especially if you want to change f and g to functions with a different number of arguments. I just don't know how to get proc (u, v, w, x, y) options operator, arrow; u^2+v^2+w*x+y-u^7-v^4-w*x^2-y^2 end proc with something like eval(h) without retyping all arguments (eval(f) works).

## Thanks...

First of all I have to correct my fit function to a+b*w/(4*(t-t0)^2+w^2) (but in the example above the result is very similar). With the parameterranges and initialvalues I get just what I wanted.

## non-negative parameters...

Here is the data plot The fit should approximately interpolate these points (values between 3000 and 8000) and not be nearly constant 11 as the fit output peak1 := 11.4838600921267774-3.8783351723659*10^9/(1+1.9217294304725*10^10*(t-.878165623495705594)^2).

## assumptions of fit parameters, array len...

I'm trying to fit a curve through some scattering data with a positive peak with the Fit function in Statistics (Maple 10). I want the parameters a,b,w and t0 of the fit function ``` a+b*w/(1+(w*(t-t0))^2) ``` to be non-negative. How can I tell Maple that? And second question: How can I determine the length of a given array (something like "nargs" for functions)?

## 'Thanks!...

Thank you very much. I wasn't used to the eval function.

## Dirac function, DTFT and possible numeri...

I've tried this (without the sum): `f:=k->int(2*Pi*Dirac(w+2*Pi*k)*e^(I*w*n), w = -infinity .. infinity);` f := proc (k) options operator, arrow; int(2*Pi*Dirac(w+2*Pi*k)*e^(I*w*n), w = -infinity .. infinity) end proc ```f(k); f(0);``` 2*Pi*e^(-2*I*Pi*k*n) 2*Pi Perhaps it might help somehow.
 1 2 Page 2 of 2
﻿