MaplePrimes Questions

Let say the procedure MyProc returns two variables as

A,B:= MyProc(…);

However, for programming purpose, I do not want to create an unused variable. Assuming one only needs B, not A, is there a way not to create and assign A?

For information, in Matlab, it is a commonly used technique. The syntax is

[~,B]= MyProc(…);

In Maple, the meaning of ~ is different, but I am looking for something similar.

 

 Today I read the  Problem 5.21 from book Maple and Mathematica, A Problem Solving Approach for Mathematics:

The book uses following codes:

with(LinearAlgebra): n:=9; v:=Vector(n); T:=v->add(v[i]*x^(i-1),i=1..n); P:=Vector(n,symbol=p); Q:=Vector(n,symbol=q); Z1:=T(a*P+b*Q); Z2:=a*T(P)+b*T(Q);
expand(T(a*P+b*Q)-(a*T(P)+b*T(Q)));
evalb(expand(Z1)=expand(Z2));

But I think  these codes just verify rather than prove(n is always specific number). This example is not difficult to prove by hand. but I'd like to know Maple how to prove it. It seems not easy.

 

 

 

 

 

 

 

 

 

 

 

Write a Maple command to define the function f that is given by

f(x)=x^5+2*x^3+3 .

In the box below, enter the part of your Maple command that is to the right of the ":=".

(Do not include the semi-colon (";") at the end.)

 

The answer I typed in is x^5 + 2*x^3 + 3 but it is wrong. Can someone help me what am I missing. 

Hi,

How to plot polygon between solutions of Complex equation

Thanks

ComplexQuestion.mw

Is it possible to connect Maple to

altibase 

I am trying to use task programming but getting incorrect results and taking more time when using a single core.  Please help

TASK_PARALLEL3.mw

Hello everyone,

I would have a question about how to colour a region of complicated inequalities.

I'm curious about the region where my 'lambdas' are all negatives regarding the parameters 'pm2' and 'am2', but I always find difficulties even if I try with implicitplot or inequal commands. Also, I would like to put into the same graph with different colours when they are separately smaller than 0.

I've already tried plenty of things, I hopefully attached some pics by snipping tool about them.  And here is an example of my problem:

p61w:= implicitplot([lambda61 <= 0], pm2 = 0 .. 1, am2 = 0 .. 1)

in61 := inequal(lambda61 <= 0, pm2 = 0 .. 1, am2 = 0 .. 1)

 

display(in61,p61w)

 

 

So, the main issue that it is not just coloured where my condition is true, but elsewhere too. In plot 'in61' as you can see, there is a region approx. pm2=0..0.6 where it shouldn't be coloured since my condition is not true there. In the graph; 'display(in61, p61w)',  it is visible that under the red line should be just coloured however my 'inequal' command coloured it outside too. 

Also, I tried with implicitplot, for example:

p6 := implicitplot([lambda61 <= 0], pm2 = 0 .. 1, am2 = 0 .. 1, filled = true, coloring = [blue, white], transparency = .5)

But the result is similarly wrong. And I'm not sure why it happens and how can I fix it.

(It's okay if for example for these particular lambdas (lambda61,lambda62) never negatives together, but I have more systems and I don't think it works properly)

I read similar questions too but I couldn't find an answer so, I would very appreciate any suggestions.

This is my first post in Maple, so please let me know if I have mistaken something.

Suppose I have an expression or a defined function that uses basic operations(typical stuff)... I have to go and add % to every operation to prevent it expanding so I can see the expression in detail. This really dirties up the formula.

 

Is there any way to automate this?

 

E.g., simple example

 

f := x->3%*x %+ x%^4;

 

 

Also %^ seems to have invalid order of operations, this seems like a bug in maple? 2%^x does not behave like 2^x in complex expressions, I have to put parathesis around it to avoid it grouping with other terms. It seems to do this with multiplication too. This then requires using tons of paranethesis to get normal expressions to behave correctly.

 

What would be real cool if one could automate all this and also have some way to control the expansion amount. E.g., some parameter than one can set to control from no expansion to full expansion(it would work by making inner most expressions inert then working to outer).

Also, it seems when I use the inert operators and make sure the precendence is correct maple evaluates the wrong value! I have used inert before and it seemed right but now I get very large values. There is something seriously buggy with %op.

If I type a differential equation in Maple software, I am getting a numerical value as in the below image. Can anybody help me to rectify the error? Thanks in advance.


 

 

 

I am experimenting with using units especially for when there are awkard conversion factors. 

The document is for motor gearbox torques inertia ration and frequency.

I have documented my specific questions in the worksheet.

I am interested is see different ways of setting this up. Like I would rather setup the formulas at the start, then supply figures.


 

restart

``

with(Units[Natural])

UseSystem('SI')

UseSystem(SI)

(1)

Can I set the units for mass, accel, etc. so I don't have to re enter the default units if I change the figures later?

``

Mass := 3000*'kg'

3000*Units:-Unit(kg)

(2)

Accel := 1.5*'m'/'s'^2

1.5*Units:-Unit(m/s^2)

(3)

Rat := 5

5

(4)

``

Radius := (1/2)*(0.8282e-1-0.6e-2)*'m'

0.3841000000e-1*Units:-Unit(m)

(5)

Torque := Mass*Accel*Radius

172.8450000*Units:-Unit(J)

(6)

````

MotorTorque := Torque/Rat

34.56900000*Units:-Unit(J)

(7)

Jload := Mass*Radius^2

4.425984300*Units:-Unit(kg*m^2)

(8)

Jmtr := 1.42*10^(-2)*'kg'*'m'^2

0.1420000000e-1*Units:-Unit(kg*m^2)

(9)

Parse:-ConvertTo1D, "first argument to _Inert_ASSIGN must be assignable"

12.46756141

(10)

stiff := convert(48, 'units', 'N'*'m(radius)'/'arcmin', 'N'*'m(rarius)'/'rad', 'symbolic')

518400/Pi

(11)

/rad

518400/Pi

(12)

"(->)"

0.16501e6

(13)

``

Freq := sqrt(stiff/Jload)/(2*Pi)/s   i.e. Hertz

30.73072153*Units:-Unit(1/(kg^(1/2)*m))

(14)

stiff := 4567

4567

(15)

Freq

30.73072153*Units:-Unit(1/(kg^(1/2)*m))

(16)

``


 

Download Units_questions.mw

I want to solve the following IBVP:

However, the answer given by pdsolve doesn't give  with pdetest.


 

restart

eq := diff(u(x, t), t)-k*(diff(u(x, t), x, x)) = 0

diff(u(x, t), t)-k*(diff(diff(u(x, t), x), x)) = 0

(1)

ic := u(x, 0) = 0

u(x, 0) = 0

(2)

bc := u(0, t) = p(t)

u(0, t) = p(t)

(3)

sol := `assuming`([simplify(pdsolve([eq, ic, bc]))], [k > 0, x > 0, t > 0])

u(x, t) = (1/2)*x*(Int(p(zeta)*exp(-(1/4)*x^2/(k*(t-zeta)))/(t-zeta)^(3/2), zeta = 0 .. t))/(Pi^(1/2)*k^(1/2))

(4)

`assuming`([simplify(pdetest(sol, [eq, ic, bc]))], [k > 0, t > 0, x > 0])

[(1/2)*x*(-t*(Int(p(zeta)*exp(-(1/4)*x^2/(k*(t-zeta)))/(t-zeta)^(7/2), zeta = 0 .. t))+limit(p(zeta)*exp(-(1/4)*x^2/(k*(t-zeta)))/(t-zeta)^(3/2), zeta = t)+Int(p(zeta)*exp(-(1/4)*x^2/(k*(t-zeta)))*zeta/(t-zeta)^(7/2), zeta = 0 .. t)+Int(p(zeta)*exp(-(1/4)*x^2/(k*(t-zeta)))/(t-zeta)^(5/2), zeta = 0 .. t))/(Pi^(1/2)*k^(1/2)), 0, -p(t)]

(5)

``

Download IBVP.mw

Hi i'm trying to plot a height(feet) and distance(time) of a projectile.

I doesn't seem to land.

Thanks in Advance

 

Projectile.mw

Hello,

       I  am trying to use the ODE Analyzer tool in order to solve a system of differential equations, and then add the plot of a polynomial function to the plot generated using the ODE Analyzer tool.

       I have successfully figured out how to use the ODE analyzer to produce the plot of the solution curve:

Here's the system of DE's:

diff(f(x), x) = u(x)

diff(u(x), x) = x + f(x) - f(x)^2

Initial conditions: f(0) = -1, u(0) = 1

The code for the solution curve is given by the ODE Analyzer as follows:

sol1 := dsolve([diff(f(x), x) = u(x), diff(u(x), x) = x + f(x) - f(x)^2, f(0) = -1, u(0) = 1], numeric, method = taylorseries[series]);
plots[odeplot](sol1, [x, f(x)], 0 .. 10, color = red);

Does anyone know how I might add an additional plot to compare to the plot the ODE Analyzer produced?

The plot I would like to add is: T(x) = -1 + x - x^2 +2/3*x^3 - 1/3*x^4 + 1/5*x^5

Thanks!

 

 

Hi there:

 

I have a short question. For an algorithm, I need a solution to a linear equation, and I use LinearAlgebra[LinearSolve]. In the case of

 

0            0                    0

                       =      

5            0                    0

 

for example, there are infinitely many, however, so Maple returns (_t2,0). My algorithm just needs one solution, if there are multiple ones, then any (except for _t2=0) is fine. However, if (_t2,0) is the saved solution, the algorithm later breaks down, since it does not expect the extra variable. Is there any way to tell Maple to replace every variable with, say, 1 when solving such an equation?

 

Currently I am using maple as a backend computer algebra system that is doing the heavy lifting for an application written in python. 

The procedure I currently use is:

app.py
```
from subprocess import run
my_input = 1233
cmd = 'cmaple -q -c input:={}: backend.mpl'.format(my_input) # Command Line call to cmaple
output = run(cmd, capture_output=True)
stdout = str(output.stdout) # A bytes object i.e. b'            1234\n\r\n\r'
# Do some string operations on stdout to get the output I want
output = stdout[-12:-8] # '1234'
```

backend.mpl
```
#do something with my_input
output := my_input+1:
#print to console to be recovered later
print(output);
quit:
```
This setup works reasonable well so long as I know exactly what format the ```output``` is going to be in but is not effective when I want to access more than one ```output``` or when the required ```output``` is a float.

I realise that I could likely save these variables to a file (a .csv say) and load them into ```app.py``` that way, but the dream is that there would be some way to directly access the variables in ```backend.mpl``` from within memory, an analogue of the ```Pipe``` framework in python for example?
 

First 246 247 248 249 250 251 252 Last Page 248 of 2132