MaplePrimes Questions

Spawned from here. The code itself is perfectly fine, but if the definition of TD is in the same cell with the rest of the code, TD gives an error. The same definition in a separate cell works.

ans := dsolve({diff(y(t), `$`(t, 2)) = y(t), y(0) = a, (D(y))(0) = 0}, numeric, parameters = [a]); td := proc (x, tt) option remember; ans(parameters = [a = x]); eval([t, y(t), diff(y(t), t)], ans(tt)) end proc; TD := proc (k::{1, 2, 3}) options operator, arrow; proc (x, tt) options operator, arrow; td(x, tt)[k] end proc end proc

(TD(1))(.2, .2)

Error, (in unknown) invalid keyword expression

 

TD := proc (k::{1, 2, 3}) options operator, arrow; proc (x, tt) options operator, arrow; td(x, tt)[k] end proc end proc

(TD(1))(.2, .2)

.2

(1)

Download td.mw

Any any good programming language or design program the format and style of a document is important for sharing with others.  But for the life of me, I don't know if I'm just missing the painfully obvious, but seriously is there not a blogpost or document about the best writing practices for using maple?

 

It would be a great help to understand general practices for formatting with the document blocks and execution groups.

How do we print the determinant as a matrix with vertical bars instead of brackets?
Thanks!

mapleatha

Hello people in mapleprimes,

I have a problem about map.

restart;
map(`*`,op([1/x,y,z]));

The output of this code is not y*z/x, but  (x*y*z)^(-y*z).

I can't understand why this occurs.
Can't you teach me about this?

Thanks in advance.

Nov_3_2017_mapleprimes.mw

This is in matlab.  How can we do this in Maple?  Or what is the similar command fft2 in Maple?

Hi,

How do i set up a Fourth order Runge-Kutta, RK4, routine to solve this nonlinear second order differential equation?:


  • a=-2, b=1
  • k=0.1
  • x0=2
  • from t=0..100


Do you have any good examples that is similar to this problem?

thanks

 

So I encountered a Chini differential equation which is solvable in terms of an implicit function

restart; assume(nu > 2, beta > 0, lambda > 0, delta > 0, y >= 0);
simplify(dsolve(beta+y+(D(h))(y) = nu*((lambda+beta+y)^2-delta*h(y))^(1/2)));

The answer is really too ugly to be pasted here, but I do get a
RootOf [ linear + log(linear) + delta* some integral + 2 * the very same integral]

It took me a quarter of an hour to deciphre that the integrals are the same and that I could get it all down to (delta+2)*integral. Because Maple did not simplify it. 

But if I copy what is inside the RootOf(), and paste it into a simplify() - then it does! So how to force it into doing that in the first place? 

 

Still novice, yes ... 

Hello guys, I have a problem using simplex, at linear exercises.

Example:

> Typesetting[delayDotProduct](with, simplex, true);
> minimize (4*x1+3*x2+5*x3,{x1-2*x2+3*x3>=-1,x1+x2-x3>=1},NONNEGATIVE);

And I got an error:

Error, Got internal error in Typesetting:-Parse : "'_Inert_DELAYLESSEQ' is not a valid inert form"

How can I solve this? I'm new in Maple software. I'm using Maple15.

Thank you, have a nice day!

restart;
unames();  # first call ok
unames();  # second call


Error, invalid input: Typeset:-Kernel expects an equation for keyword parameter numericformatting

Error, unexpected result from Typesetting

 

Hi,

I want to define an operator P, which can shift the first subscript of u(i,j)

P: u(i,j)->u(i+1,j)

and similarly,

Q: u(i,j)->u(i,j+1)

I am not familiar with the commands in maple, please help!

Thanks.

I have a polynomial of 4th order and I wanted to use allvalues on the RootOf expression. It then says:
 

Error, (in evala/Normal/preproc) reducible RootOf detected.  Substitutions are {RootOf(4678560000000000000000000000000000000000+(16573041*CO^2+70122975000000000000*CO-623180900000000000000000000000000)*_Z^4+(-19887649200*CO^2-82987335000000000000000*CO+745755960000000000000000000000000000)*_Z^3+(5966294760000*CO^2+23851989000000000000000000*CO-221858784000000000000000000000000000000)*_Z^2+(417684600000000000000000000*CO-757598400000000000000000000000000000000)*_Z) = 600, RootOf(4678560000000000000000000000000000000000+(16573041*CO^2+70122975000000000000*CO-623180900000000000000000000000000)*_Z^4+(-19887649200*CO^2-82987335000000000000000*CO+...
Error, (in allvalues) numeric exception: division by zero

So apparently the expression is reducible but how do I do that?

I'm working with Fourier Transform. I'd like to transform a noisy image to the frequency domain, create a grayscale version of the spectrum, mask the dots or lines, threshold it, multiply the binary mask image with the magnitude image and then transform back to the spatial domain. Is this possible using Maple?

 

Any help would be appreciated.

I have a procedure, se, that takes 2 real numbers as arguments and returns a list of 3 real numbers,
so, for example,
se(1.2,2.7)=[-5.85,3.24,3.9].
(The exact nature of that procedure should not be important for plotting purposes.) 

The command   >plot3d(se(x,y),x=0..2,y=-2..3);  returns a surface plot as hoped.   
(I had some doubt because the help page suggests one needs 3 functions or procedures [f,g,h] to get a 3 d plot rather than one procedure that generates a list of 3 values but Maple 2017.3 came through). 
I have another procedure , td,that takes 2 real numbers as arguments and returns a list of 3 real numbers,  ;
so, for example,
td(2.7, 3.4)=[3.4, .594943507924521, -.111391393034295].

(Again, the exact nature of that procedure should not be important for plotting purposes.) 
The command   > plot3d(td(x,t),x=0..2,t=0..3);  returns the error message: 

Error, (in dsolve/numeric/process_parameters) parameter values must evaluate to numeric, got a = x

For some reason, plot3d is going back to the body of the procedure, td, rather than just accepting the values it provides.

Knowing that quotes can sometimes solve this sort of problem I then tried:
plot3d('td(x, t)', x = 0 .. 2, t = 0 .. 3);
only to get

Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct

I am not sure what plot3d is complaining about. The procedure I believe has all the information it needs in the form it needs it.
I then tried another workaround.

I set td1(x,t) :=td(x,t)[1], td2(x,t) :=td(x,t)[2], td3(x,t) :=td(x,t)[3] and tried :
plot3d([td1(x, t), td2(x, t), td3(x, t)], x = 0 .. 3, t = 0 .. 2);
to get
Error, (in dsolve/numeric/process_parameters) parameter values must evaluate to numeric, got a = x
Again, for some reason, plot3d is going back to the body of the procedure td.

Finally, I tried:
plot3d('[td1(x, t), td2(x, t), td3(x, t)]', x = 0 .. 3, t = 0 .. 2);
 
and I got the plot I wanted.

I am very happy to have a working file but I do not understand what worked and why. The nest time I have such a problem I will have to resort to the mysterious syntax manipulations again and hope that I hit on a combination that works.

For completeness I include the procedure bodies for  se and td below but I think that is irrelevant information.

se := proc (x, y) [x^2-y^2, x*y, x+y] end proc;


td := proc (x, tt)
local des, ff, fpfp; global ans;
ans(parameters = [a = x]);
des := ans(tt); ff := rhs(des[2]); fpfp := rhs(des[3]); [tt, ff, fpfp]
end proc;
 and
ans:=dsolve(ic,numeric,parameters=[a]):  where ic is an ode (I used several with the same result) with initial condition involving a.;

Can anybody explain what is happening?

 

How does one declare 3d vector in Maple, say p1, p3, and x, and integrate the following function from -Infinity to q, and q to + Infinity? Note that there is an iota in the exponential, and p1.x is the dot product of p1 and x

Integrate from -Infinity to q, q to infinity w.r.t. p1 and p3 

e^( - i p1 . x ) * 1/((p3 -p1)^2)

The integration should preferably be in spherical co-ordinates, but a demonstration in Cartesian co-ordinates would also be helpful. 

eqs := [D[1, 2](u)(x, y) = x+y, u(x, 0) = x, u(0, y) = y]:

pdsolve(eqs[1], u(x, y));
                       u(x, y) = _F2(x)+_F1(y)+(1/2)*x^2*y+(1/2)*x*y^2

pdsolve(eqs[1 .. 2], u(x, y)); # indeterminate
                       u(x, y) = invfourier((y^2*undefined+signum(y)*infinity+y*(limit(-(2*I)*Pi*y/s1,
                       s1 = 0))+undefined)*Dirac(s1)+2*Pi*(limit((I*s1+y)/s1, s1 = 0))*Dirac(1, s1), s1, x)

pdsolve(eqs, u(x, y)); # doesn't satisfy the DE
                       u(x, y) = (Int(1, tau1 = 0 .. y)+1)*(-_F1(0)+x-_F2(0)+y)

(value@eval)(eqs, u = unapply(rhs(%), [x, y]));
                       [1 = x+y, -_F1(0)+x-_F2(0) = x, (y+1)*(-_F1(0)-_F2(0)+y) = y]

The first pdsolve is fine, but not the other two.

First 792 793 794 795 796 797 798 Last Page 794 of 2308