MaplePrimes Questions

I am trying to solve system of differential equation as shown in file attached. The differentail eqaution has peicewise function for t=8*n and t not equal to 8*n where n is a positive integer. but i am getting error. please help.

 

 

problem30.mw

Thanks to Mr. Joe Riel, my previous problem is the port's name and the input signal's name was the same name was solved. It worked well in the new model but when I try to do exactly the same thing in my current model, the custom component can't be generated even if the "Check dimension" button shown that "no issues found". 

This time error is:
(in SetComponent) flattening error: Errors: Input length = 1
Error in Component btnGenComponent with the caption "Generate MapleSim Component"

Does anyone know from what this error "Input length = 1" happens? 

I am very appreciated for your help.

This started as calculating the location of a machine tool bit that is tangent to a line and a circle.  I watched the part being made.  The machinist moved the tool bit manually until it touched straight and circular markings on a aluminum blank.  Repeating this two times, recording the x-y values, the g-code was altered and the CNC machine started to make the part.  Should be a simple calculation, right?

Well, not for me:

restart; with(geometry):
## Find the (x, y) location of a machine mill path such that the tool is
## tangent to a line and a circle.
##
## Given a line, L1, and a circle, C1, find a circle, C4 tangent to
## both L1 and C1.  Choose the X value of C4 to be such that the
## center of C4 is between the intersection of L1 with the X axis and
## origin.
x0 := (3+1/2)/2;
x1 := x0; y1 := x0 + (1+1/4);
point('P1', x1, y1); ## center of the circle

circle('C2', [P1, x0]);

## X value for line L1
x3 := (3+1/2)/2-(3/4+20/1000)/2-1/2; y3 := 1+1/4; evalf([x3, y3]);
## points P2 and P3 lie on the line
point('P2', x3, 0); point('P3', x3, y3);
line('L1', [P2, P3]);

intersection('I1', L1, C2);
for s in I1 do print(evalf(coordinates(s))) end do;

tr := 1/8;  ## tool radius, radius of C4
## find P4 such that C4 is tangent to L1
x4 := x3 - tr;
## P4 moves parallel to L1
point('P4', x4, 'y4');
circle('C4', [P4, tr]);
Equation(C4); Equation(C2);
intersection('I2', C2, C4);
## fails

## The centerline of the part is at x = (3+1/2)/2 Another dimension of
## the part, is (3/4+20/1000), centered on the centerline.  A second
## dimension of the part is 1/2.  From the physical layout of the
## part, observe that
x_value := (3+1/2)/2 - (3/4+20/1000)/2 - 1/2 - tr: evalf(%);
eq1 := subs(x = x_value, Equation(C4)); eq2 := subs(x = x_value, Equation(C2));
sol := solve([eq1, eq2]); evalf(%);
evalf(sol);

## want the solution with the least y value for point P4
res1 := subs(sol[1], coordinates(P4));
res2 := subs(sol[2], coordinates(P4));

if evalf(res1[2]) < evalf(res2[2]) then
    soln := res1;
else
    soln := res2;
end if;
evalf(soln);

point('P8', soln); evalf(coordinates(P8));
circle('C8', [P8, 1/8]); evalf(Equation(C8)); evalf(Equation(C2));
## the intersect fails  Why?

intersection('I8', C2, C8);

evalf(coordinates(I8[1])); evalf(coordinates(I8[2]));

solve([Equation(C2), Equation(C8)]); evalf(%);
print("The location is", evalf(soln));

 

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("&rarr;"))`^2/(((a^2+`#mover(mi("p"),mo("&rarr;"))`^2)^2)(`#mover(mi("p"),mo("&rarr;"))`-`#mover(mi("q"),mo("&rarr;"))`+`#mover(mi("w"),mo("&rarr;"))`).(`#mover(mi("p"),mo("&rarr;"))`-`#mover(mi("q"),mo("&rarr;"))`+`#mover(mi("w"),mo("&rarr;"))`)+b1^2)'

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

(4)

NULL

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

`#mover(mi("p"),mo("&rarr;"))`^2*infinity/((a(`#mover(mi("p"),mo("&rarr;"))`-`#mover(mi("q"),mo("&rarr;"))`+`#mover(mi("w"),mo("&rarr;"))`)^2+`#mover(mi("p"),mo("&rarr;"))`(`#mover(mi("p"),mo("&rarr;"))`-`#mover(mi("q"),mo("&rarr;"))`+`#mover(mi("w"),mo("&rarr;"))`)^2)^2.(`#mover(mi("p"),mo("&rarr;"))`-`#mover(mi("q"),mo("&rarr;"))`+`#mover(mi("w"),mo("&rarr;"))`)+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);

 

First 780 781 782 783 784 785 786 Last Page 782 of 2427