MaplePrimes Questions

In the worksheet below, variable x can be returned to type name after being assigned a value , but concatenated variable name A||1 cannot. Is there a way to return a concatenated variable to type name after it has been assigned a value, so it can be re-used as an unknown in solve commands?

Concatenate_Question.mw

 

Hello Everyone,

I have an equation system which is under-determined and thus yields infinite solutions. 
These usually come in the form of "_t1[1]" or similar variables. Mostly one, sometimes even two.
I am also working on a script for automated solving of a buckling problem and the solution yields of course these t-variables.
Everytime the code run, I get a different t-variable, which makes automation harder.

Please see attached code. (Of course simplified, not my actual code.)

It starts with a random matrix and a solution vector for the equation system.
The system is solved and its coefficients transfered to an equation.
However every time I hit "Enter" on the LinearSolve command, the name of the _t4[1] variable changes.

Is there a way to keep getting the same variable name? How do you work with this?

Best Regards,
Lennart

A := Matrix(4, 4, {(1, 1) = 1, (1, 2) = 3, (1, 3) = 4.5, (1, 4) = 7, (2, 1) = 0, (2, 2) = 2, (2, 3) = 5, (2, 4) = 9, (3, 1) = 0, (3, 2) = 0, (3, 3) = 0, (3, 4) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = 0}); B := Vector(4, {(1) = 0, (2) = 0, (3) = 0, (4) = 0}); C := LinearAlgebra[LinearSolve](A, B)

Vector[column](%id = 18446746248681490062)

(1)

W1 := C[1]; W2 := C[2]; W3 := C[3]; W4 := C[4]; Q := W1*x^4+W2*x^3+W3*x^2+W1

(HFloat(3.0)*_t4[2]+HFloat(6.5)*_t4[1])*x^4+(-HFloat(2.5)*_t4[2]-HFloat(4.5)*_t4[1])*x^3+_t4[2]*x^2+HFloat(3.0)*_t4[2]+HFloat(6.5)*_t4[1]

(2)

restart

``


 

Download MultipleTCoefficients.mw

when i solve adomian polynomials there is a derivative withrespect to t and then put t is equal to zero. now i have to find the dervative of function with respect to t but it is already equals to zero. and i change the variable the Df could not b solved.
 

restart

with(LinearAlgebra):

F(u[i]) := u[i]^2:

NULL

for n from 0 while n <= 6 do F(u[n]) := x[n]^2; V[n] := (diff(F(sum(t^i*u[i], i = 0 .. n)), [`$`(t, n)]))/factorial(n) end do:

t := 0;

0

(1)

for i from 0 while i <= n-1 do A[i] := V[i] end do;

x[0]^2

 

(D(F))(u[0])*u[1]

 

(1/2)*((D@@2)(F))(u[0])*u[1]^2+(D(F))(u[0])*u[2]

 

(1/6)*((D@@3)(F))(u[0])*u[1]^3+((D@@2)(F))(u[0])*u[1]*u[2]+(D(F))(u[0])*u[3]

 

(1/24)*((D@@4)(F))(u[0])*u[1]^4+(1/2)*((D@@3)(F))(u[0])*u[1]^2*u[2]+(1/2)*((D@@2)(F))(u[0])*u[2]^2+((D@@2)(F))(u[0])*u[1]*u[3]+(D(F))(u[0])*u[4]

 

(1/120)*((D@@5)(F))(u[0])*u[1]^5+(1/6)*((D@@4)(F))(u[0])*u[1]^3*u[2]+(1/2)*((D@@3)(F))(u[0])*u[1]*u[2]^2+(1/2)*((D@@3)(F))(u[0])*u[1]^2*u[3]+((D@@2)(F))(u[0])*u[2]*u[3]+((D@@2)(F))(u[0])*u[1]*u[4]+(D(F))(u[0])*u[5]

 

(1/720)*((D@@6)(F))(u[0])*u[1]^6+(1/24)*((D@@5)(F))(u[0])*u[1]^4*u[2]+(1/4)*((D@@4)(F))(u[0])*u[1]^2*u[2]^2+(1/6)*((D@@4)(F))(u[0])*u[1]^3*u[3]+(1/6)*((D@@3)(F))(u[0])*u[2]^3+((D@@3)(F))(u[0])*u[1]*u[2]*u[3]+(1/2)*((D@@3)(F))(u[0])*u[1]^2*u[4]+(1/2)*((D@@2)(F))(u[0])*u[3]^2+((D@@2)(F))(u[0])*u[2]*u[4]+((D@@2)(F))(u[0])*u[1]*u[5]+(D(F))(u[0])*u[6]

(2)

NULL


 

Download Adomian_Polynomials.mw

I want to create a simple symbolic transfer function from 2 vectors, lets say:        num=<a,b,c>

                                                                                                                               den=<c,b,a,d>
So my transfer function should look like this:
              H(s) = (a*s^2 + b*s + c)/(c*s^3 + b*s^2 +a*s+d)

 

This should be very simple but I haven't found a solution on the forums yet...

Thank you.

Is it possible to develop a code for base excitation problem where excitation data is of earthquake acceleration?

p.s. There are 12000 data available in EQ file.

Hi, I have a 1D wave equation with a piecewise initial value, I am trying to plot the solution with animation, I use the below code, However, it does not give me the animation I want but give me some error, which I am not understande.

My code is following:

pde := diff(u(x, t), t $ 2) - diff(u(x, t), x $ 2) = 0

h := piecewise(-1 <= x and x <= 0, x + 2, 0 <= x and x <= 1, 2 - x, 0)

ic := u(x, 0) = h, D[2](u)(x, 0) = 0

sol := pdsolve([pde, ic])

plots[animate](plot, [sol, x = -10 .. 10], t = 0 .. 5)

and the result is showing as picture below

There is a bug in simplify, specifically in `simplify/inert`, that prevents returning the simplified result if any of "inertfunctionnames" doesn't have a corresponding simplification procedure "inertsimplifications" (these are the names from `simplify/inert` code).
To see this, consider a simple example:

`simplify/%F`:=proc(X)
subsindets(X,'specfunc'(%F),2*`op`)
end proc:

Then we have:
A:=%F(a+b)+%G(a);
                   

simplify(A);
                       

Now, let's define a "dummy" simplification function for %G, e.g.:
`simplify/%G`:=proc(X) X end proc:

Only now do we get what we should:
forget(simplify);
simplify(A);

                     

The reason for this misbehavior seems to be simple: in `simplify/inert` any performed simplification is neglected if  "inertfunctions"<>{}. This should be corrected.

Dear Community,

Maple has the fancy VoronoiDiagram command, which generates Voronoi grids from a set of 2D distributed points. Does somebody know how the cornerpoint coordinates of the individual Voronoi cells  of the obtained Voronoi grid can be exported as a list of (xi, yi)  coordinate pairs? Could you possibly give a simple example?

Tx in advance, best regards

Andras

 

 

Hi, I'm solving a complicated ODEs. It is a multiple point bvp. Last time I asked a question about a similar problem(you can see https://www.mapleprimes.com/questions/230626-I-Am-Trying-To-Solve-A-Set-Of-ODEs-With). And when I use the last point 's solution to obtain the next point's solution (via approxsoln=..), it works well (it's the replicate of other people's paper). But this time I changed theoretical model, so the input parameters and the equations are some different from the previous. Some problems appears again. In the code I used a loop to calculate solutions with different lambda, but the code works on some points in front, then it appears an error "initial Newton iteration is not converging". 

Do you have some ideas to overcome it?

 

dsolveODEs.mw

I am getting this error when I attempt a DE plot

I have an issue where I believe the values given by evalf (I have independent verification), but the plot of the same function is incorrect. Specifically, g(a) plotted for a <=0 is correct, and incorrect for a > 0.

What am I doing wrong?


g:=(a)->int(exp(-(x^2-a)^2),x=0..infinity)
plot(g(a), a=-2..5) #I don't believe anything for a > 0

evalf(g(-1)) #I believe all of these values
                          0.2059311656
evalf(g(0))
                          0.9064024772
evalf(g(1))
                          0.9868660750

 

Mattthew

Dear Maple community,

I'm trying to simplify the attached Expression "under several parameter constraints", see simplify_under_constraint.mw

The constraints are threefold:

1. pi[1, 1, 1, F] + pi[2, 1, 1, F] + pi[3, 1, 1, F] = 1,

2. pi[1, 2, 1, F] + pi[2, 2, 1, F] + pi[3, 2, 1, F] = 1

3. pi[1, 3, 1, F] + pi[2, 3, 1, F] + pi[3, 3, 1, F] = 1,

It seems like, whenever the constraints appear in the exact order as specified above, simplify(Expression, {(pi[1, 3, 1, F] + pi[2, 3, 1, F] + pi[3, 3, 1, F]) = 1, (pi[1, 1, 1, F] + pi[2, 1, 1, F] + pi[3, 1, 1, F]) = 1, (pi[1, 2, 1, F] + pi[2, 2, 1, F] + pi[3, 2, 1, F]) = 1}) can somewhat simplify the Expression. However, is there a way for Maple to recognize the above-mentioned constraints for all possible "permutations" of, say, pi[1, 3, 1, F] = 1 - pi[2, 3, 1, F] - pi[3, 3, 1, F]; pi[2, 3, 1, F] = 1 - pi[1, 3, 1, F] - pi[3, 3, 1, F], etc. and simplify the expression in the most compact manner.

Thank you.

 

 

Hello Everyone,

I am currently trying to tidy up my worksheet and hide all of the script/code that I wrote in the Maple 2D-Math within the execution script of buttons etc.
Was going well so far until I started transferring code where I was using a lot of symbolic math (if I understood correctly)
There is one instance where I have a variable chi which equals x divided by a.
a being a number, e.g. 5000, while x is and remains a variable.
No problem in 2D-Math as the unknown x is dragged through all following equations.

Not so in the code editor, I think. Doing the calculation results not in x/5000, but in this:


It keeps getting worse because this term will be derived, assembled into a matrix, etc. where the expressions are getting ridiculous:


Without getting into the details of what my script should do, I believe this is a very general issue, not specific to my code.

Is the code editor / "Code when Used/Clicked" not capable of symbolic math? Oder is there some setting that could potentially help me?

Best Regards,
Lennart
 

Hi

I am trying to implement a controler for a 6dof robot. This requires a number of matrixis one among them is the mass matrix.

I have the matrix equation from using the multibody analysis tool and was thinking to use this matrix equation to construct a custom componet that takes the angels of the robot joints as inputs and have the 6 x 6 mass matrix as an output.

However when I complete the component generation am I greeted with this error message.

(in MapleSim:-Modelica:-PrintModel) unable to print Matrix(6, 6, {(1, 1) = ((1/5000)*(5000*`msim/RNAME`(_msim_End_effector_M)+5000*`msim/RNAME`(_msim_Wrist_2_M)+2500)*(`msim/RNAME`(_msim_Wrist_1_H)+`msim/RNAME`(_msim_Wrist_2_H))*`msim/RNAME`(_msim_Upper_Arm_H)*cos(`msim/RNAME`(_msim_R3_theta))-(1/5000)*(5000*`msim/RNAME`(_msim_End_effector_M)*(`msim/RNAME`(_msim_End_effector_H)+`msim/RNAME`(_msim_Wrist_2_W))+5000*`msim/RNAME`(_msim_End_effector_H)+2500*`msim/RNAME`(_msim_Wrist_2_W))*sin(`msim/RNAME`(_msim_R5_theta))*`msim/RNAME`(_msim_Upper_Arm_H)*sin(`msim/RNAME`(_msim_R3_theta))+(1/5000)*(5000*`msim/RNAME`(_msim_End_e ... NAME`(_msim_Wrist_1_M)+(1/8)*`msim/RNAME`(_msim_Wrist_1_W)^2+7/10000})

Error in Component btnGenComponent with caption "Generate MapleSim Component

 

Most of it is just fragments of the (1,1) equations but what I take away from it is that it complains on a missmach between the 6 X 6 matrix and the output port. 

After researching the question, however, I have not managed to find a good answer to this so I ask this wonderful forum for help.

Is it posible to have a matrix as an output from a custom component? If it is then how?

Mvh

Eric Ragnarsson

Why doesn't Maple 13 plot x^(1/3) for x negative?

Thank you.

mapleatha

First 429 430 431 432 433 434 435 Last Page 431 of 2362