MaplePrimes Questions

Hi,

I am trying to do a simple numerical calculation, and need to evaluate functions on a grid. I woult then like to build expression like finite differences, such as

Y[ i + 1 ] - Y[ i - 1 ]

where Y is my Array of function values. However I would then always get the "Error, bad index into Array", even though in the expressions I build i is specified as a summation index over a certain range. Interestingly, indexing with an i works though within the sequence command: seq( Y[ i ], i = 1..n) would produce an output.

I am not sure what is going on.

Thanks for Help!

If I type pi, Maple just show what I typed, but if I insert the Greek letter pi, then it works. Are there other things that I should take care of them when I'm using "floor" command in my programming?

help me for remove this error.

Error, `;` unexpected
 

thanks_Prab.mw

 

Hello

 

Please have a look at the attached picture. I create an expression, hit enter, then Maple auto simplifies it causing a mess. How do i prevent Maple from manipulating expressions?

Thanks

 

https://www.dropbox.com/s/o12crq77b0qffmy/maple_auto_simp.jpg?dl=0

 

 

 

I am not sure why I am getting this RootOf result when I solve for x.

Here is my code.

restart:
eq:=4*x^2+2*y(x)^2=32.5625:
deq:=solve(  diff(eq,x), diff(y(x),x) ):
deq=3;
y(x)=solve(deq=3,y(x));
x=solve(deq=3,x);

The last equation we are solving is  -2x / y = 3.
So we should get y  = -2/3 x and  x = -3/2 y.

The Maple software correctly solves for y in terms of x,
but gives an odd Rootof answer when solving for x. Why is that?

I am not sure how to intepret RootOf(2*_Z+3*y(_Z)).

What is it that's wrong with the following input in Maple?
Note that all variables are real. The sample worksheet is attached. 


 

NULL

with(Physics[Vectors])

p_ := px_i+py_j+pz_k

px_i+py_j+pz_k

(1)

NULL

q_ := qx_i+qy_j+qz_k

qx_i+qy_j+qz_k

(2)

NULL

w_ := wx_i+wy_j+wz_k

wx_i+wy_j+wz_k

(3)

NULL

'`#mover(mi("p"),mo("→"))`^2/(((a^2+`#mover(mi("p"),mo("→"))`^2)^2)(`#mover(mi("p"),mo("→"))`-`#mover(mi("q"),mo("→"))`+`#mover(mi("w"),mo("→"))`).(`#mover(mi("p"),mo("→"))`-`#mover(mi("q"),mo("→"))`+`#mover(mi("w"),mo("→"))`)+b1^2)'

`#mover(mi("p"),mo("→"))`^2/(Typesetting:-delayDotProduct(((a^2+`#mover(mi("p"),mo("→"))`^2)^2)(`#mover(mi("p"),mo("→"))`-`#mover(mi("q"),mo("→"))`+`#mover(mi("w"),mo("→"))`), `#mover(mi("p"),mo("→"))`-`#mover(mi("q"),mo("→"))`+`#mover(mi("w"),mo("→"))`)+b1^2)

(4)

NULL

int(`#mover(mi("p"),mo("→"))`^2/(Typesetting:-delayDotProduct(((a^2+`#mover(mi("p"),mo("→"))`^2)^2)(`#mover(mi("p"),mo("→"))`-`#mover(mi("q"),mo("→"))`+`#mover(mi("w"),mo("→"))`), `#mover(mi("p"),mo("→"))`-`#mover(mi("q"),mo("→"))`+`#mover(mi("w"),mo("→"))`)+b1^2), [px = -infinity .. infinity, py = -infinity .. infinity, pz = -infinity .. infinity])

`#mover(mi("p"),mo("→"))`^2*infinity/((a(`#mover(mi("p"),mo("→"))`-`#mover(mi("q"),mo("→"))`+`#mover(mi("w"),mo("→"))`)^2+`#mover(mi("p"),mo("→"))`(`#mover(mi("p"),mo("→"))`-`#mover(mi("q"),mo("→"))`+`#mover(mi("w"),mo("→"))`)^2)^2.(`#mover(mi("p"),mo("→"))`-`#mover(mi("q"),mo("→"))`+`#mover(mi("w"),mo("→"))`)+b1^2)

(5)

NULL

NULL

NULL


 

Download Integration-Vec-Example.mw

Hi,

I'm new into Maple and I need some serious help. I'm supposed to read numbers from file (teploty.txt) and according to value assign some text to them and write it in other file (barvy.txt). I think I've done it right (propably not, I learn it for like half a year), but Maple keeps writing "Error, cannot determine if this expression is true or false: value < 20".

Can anybody help me, please?

Thank a lot!

Hello,

      I've noticed a strange phenomenon involving simplify: given the exact same input, its output varies between two different results depending on memory usage patterns.

      I've attached a sample code. There, I have an equation which should simplify to 0=0. If I run the code with garbage collection gc uncommented, it will correctly give 0=0. However, with gc commented out, it gives the unsimplified result result ~80% of the time (with 0=0 the remaining 20%):

1/2*A1*k*epsilon*p*(-I*exp(I*psi__p)*(2-2*cos(2*psi__p))^(1/2)+exp(2*I*psi__p)-1)*exp(-I*psi__p-1/2*2^(1/2)*k^(1/2)*(-k*p*cos(psi__p)+(k^2*p^2+2*k*p*
cos(psi__p)+1)^(1/2)-1)^(1/2)*t)*(-exp(-I*k*x-1/2*I*2^(1/2)*k^(1/2)*(k*p*cos(psi__p)+(k^2*p^2+2*k*p*cos(psi__p)+1)^(1/2)+1)^(1/2)*t)+exp(I*k*x+1/2*I*
2^(1/2)*k^(1/2)*(k*p*cos(psi__p)+(k^2*p^2+2*k*p*cos(psi__p)+1)^(1/2)+1)^(1/2)*t)) = 0

For my particular machine, it seems that when the memory usage is <98.4MB, it gives 0=0, and the unsimplied case otherwise.

      Any idea why this is? It seems odd that simplify would return different results depending on garbage collection, especially since use of gc is now discouraged.

example.txt

A few notes:

  • It seems replacing gc with a simple call to kernelopts(memusage) also produces the correct output
  • This is a snippet of a larger body of code I wrote: there, even without gc, it will sporadically (with the exact same input) produce the correct answer ~50% of the time
  • Only the last 4 lines are relevant; the beginning of the attached code is simply to generate appropriate memory usage and doesn't affect the relevant, final 4 lines

EDIT

I could solve my problem already. I edit in the solution at the end, in case some one ever runs into the same issue, and is happy finding this post when searching for a solution.

/EDIT

 

Hi there!

I am starting to learn how to use the Optimization package. The help page for the NLPSolve command contains the example

NLPSolve(sin(x)/x, x=1..30)

which would spit out the local minumum at x=23.519… with value -0.042… .

I tried to use the initialpoint option in order to solve for other local minima or maxima, but regardless which initial point choose, I get

Warning, initial point option ignored by solver

and again the same local minimum as before. I entered the option as follows:

NLPSolve(sin(x)/x, x=1..30,initialpoint={x=17})

I am not sure why it doesn't work, since the NLPSolve help page contains an example using the initialpoint option right underneath this example, and there everything works as intended.

Does anyone know what is going on here?

Cheers!

 

EDIT

The problem was that NLPSolve uses the quadratic interpolation method by default if the function which should be extremised is univariate and unconstrained. This information can be found under the Optimization/General/Methods help page. This method however, is the only one which doesn't accept an initialpoint. Hence, the solution is to apply a different method, such as

NLPSolve(sin(x)/x, x=1..30,initialpoint={x=17},method=modifiednewton)

/EDIT

restart; with(Physics);
Setup(mathematicalnotation = true);
                 [mathematicalnotation = true]
Setup(signature = `-+++`);
                     [signature = - + + +]
Coordinates(M = [t, rho, z, phi]);
 

  Default differentiation variables for d_, D_ and dAlembertian 

   are: (Mequals(t,&rho;,z,&phi;))
 Systems of spacetime Coordinates are: (Mequals(t,&rho;,z,&phi;))
                              {M}
ds2 := -exp(2*psi(rho, z))*d*(t^2)+exp(2*gamma(rho, z)-2*psi(rho, z))*(drho^2+dz^2)+exp(-2*psi(rho, z))*(rho^2)*(dphi^2);
                                  2
    ds2 := -exp(2 psi(rho, z)) d t 

                                              /    2     2\
       + exp(2 gamma(rho, z) - 2 psi(rho, z)) \drho  + dz /

                                2     2
       + exp(-2 psi(rho, z)) rho  dphi 
Setup(metric = ds2);
Error, (in Physics:-Setup) expected the metric as an expression quadratic in [d_(t), d_(rho), d_(z), d_(phi)], or square Matrix, Array or table with 4 lines and 4 columns; or a set with the nonzero components of such a matrix; received: -exp(2*psi(rho, z))*d*t^2+exp(2*gamma(rho, z)-2*psi(rho, z))*(drho^2+dz^2)+exp(-2*psi(rho, z))*rho^2*dphi^2

Hi

In mathematics, the inverse problem for Lagrangian mechanics (Helmholtz inverse problem) is the problem of determining whether a given system of ordinary differential equations can arise as the Euler–Lagrange equations for some Lagrangian function. 

For more information read section IV.2. page 65 of the following reference:

http://www.unilim.fr/pages_perso/loic.bourdin/Documents/bourdin-thesis2013.pdf

________________________________________________________________________

 

I need some hints or procedures (if it is possible) for similar (but a little more complex) problem:

1- Assume that you have one ordinary differential equation, ode1(r) in polar coordinate system (i.e. (r, theta)). The ODE is taken to be independent from theta (It is not a PDE).

2- Assume that "Euler" is an operator that gives the Euler-Lagrange equation, I need a procedure to calculate ode2(r) such that

1/(2r)*Euler (ode2(r)) -Laplacian (1/(2r)*Euler(ode1(r)))=0

It is obvious that we need inverse of Euler operator (say IE) to calculate ode2(r).

ode2(r) =IE( 2r*Laplacian (1/(2r)*Euler(ode1(r))))

I calculate ode2(r) for some simpler cases via trial and error method.

s := proc (S) 
subs(w = w(r), w1 = diff(w(r), r), w2 = diff(w(r), r$2), S) 
end proc: 
Euler := proc (f) 
s(diff(f, w))-(diff(s(diff(f, w1)), r))+diff(s(diff(f, w2)), r$2) 
end proc:

Example:

ode1(r) = -r*(diff(w(r),r))^2:

ode2(r) = (diff(w(r),r))^2/r+r*(diff(w(r),r$2))^2:

-1/(2*r)*Euler(w1^2*r):

simplify(1/(2*r)*Euler(w1^2/r+r*w2^2)-VectorCalculus:-Laplacian(%,('polar')[r,theta]))

I will be grateful if you can hint me to write an appropriate procedure.

Thanks

Hello all,

I am trying to replace an expression with a variable using the algsubs command. Basically I have a vector evecA1 where I want to replace everywhere the expression rho*c^2/(gamma-1)*(1/rho)+(1/2)*u^2 occurs by the variable H.  I will post my code so you can see what i was trying to do. Any help is appreciated.

F := [q2, q2^2/q1+(gamma-1)*(q3-q2^2/(2*q1)), q3*q2/q1+(gamma-1)*(q3-q2^2/(2*q1))*q2/q1];
Q := [q1, q2, q3];

with(VectorCalculus);
A := Jacobian(F, Q);

A := subs(q1 = rho, q2 = rho*u, q3 = rho*e, A);
A := subs(e = P/(rho*(gamma-1))+(1/2)*u^2, A);
A := subs(P = rho*c^2/gamma, A);
A := simplify(A);
with(LinearAlgebra);
evalsA := simplify(Eigenvalues(A));
with(LinearAlgebra);
evecA1 := Eigenvectors(A);

algsubs(rho*c^2/(gamma-1)*(1/rho)+(1/2)*u^2 = H, evecAI);

 

I have this list

L := {a = b, e = f};

I want to extract b and f

How can i do it ?

Hi there,

I am looking at the system of equations

0=2*r*(H*(2-H)-3*sin(theta)^2)

0=-3*sin(2*theta)

with

H=sqrt(1-2*r*cos(theta))

Using the solve command with the assumption r >= 0 gives the solutions [r=0, theta=0], [r=1/2, theta=0] and [r=3/2, theta=pi].

However [r=0, theta=pi/2] is also a solution, which the solve command doesn't give me. Why not, and why doesn't if even give a warning that there are more solutions, which are not given?

Cheers!

 

Hi there,

Guess the title is already the full question. I want to write mathematical expressions in 2D math within a text segment of my Maple 15 document, but it should not be recognised as an execution group. How can I do this?

Cheers!

First 781 782 783 784 785 786 787 Last Page 783 of 2428