Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

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!

 

 

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?
 

I have a variable that can take multiple values since it is the RootOf solution of a polynomial. Based on the setup of the problem, the variable should be between 0 and 1, and therefore should be only one of the four values spitted out by the allvalues of the RootOf function. How can I make Maple understand that this variable should only take one of the four values that is the outcome of allvalues of the RootOf function? Can I define this variable to be between 0 and 1 upfront? If not, how do you make Maple "pick" only one value out of multiple outcomes of allvalues evaluation?

 

Dear friends, please I would like to ask for your help with the following problem: 

I need to invoke the number of elements of an Array working with parallel programming in the task programming model. I've tried to used the command rtable_num_elems as it is contained in the thread safe functions lists. However, Maple does not recognize it as I obtain the error "Bad index into array". Using the same code, I've substituted the array for a list and rtable_num_elems for nops and the code works perfectly. What could I be doing wrong? I need to use arrays given the extension of the data I'm handling. 

Many thanks for your kind help. 

I have this problem, that maple wont isolate for x_1. I want to automate the prosses of any funktion, but how come it not work?

Hope you can help 

Hi,

What could be an easy solution to get 2-d, 3-d etc derivatives (∂^2 V)/(∂x^2) ..,

subject to the conditions

1) 1/V(x,y) (∂V/∂x)=α(x,y)

2) -V(x,y)/diff(V(x,y),y)=beta(x,y)

More or less easy with (1), a bit tricky with (2) but is there any more or less simple and common (universal) solution(s) both for (1)-(2) and similar? I mean, find derivatives (2-d, 3-d, ...) with known first derivative.

Best

How to find the coefficient of x, x^2,and xy from the following polynomial

 

F:-2*x+6*y+4*x^2+12*x*y-5*y^2

 

coeff(F, x) gives an answer 12*y+2 but I want it as 2 etc

coeff(F, x*y) gives an error 

Error, invalid input: coeff received x*y, which is not valid for its 2nd argument, x
 

Dear maple users,

Greetings.

How to plot a contour for the below-mentioned function.

f(x):=-0.09465519086 x^3+0.02711194463 x^2+0.3862193003 x-0.00030060626-0.0003613678673 x^6-0.001538973646 x^5-0.01937304057 x^4-3.822344860 10^(-8) x^8-0.000007297718101 x^7

 

Anyone have any thoughts on how I can combine these two terms? (see screen shot)  The error message implies the units are somehow not really the same but there is no help page for this error.  Any insight would be appreciated.  Thanks.

Here is the file:  units_issue.mw

 

I want to creat a two dimisional plot of a circle.   Every time I try it gives me a parabola.

First 536 537 538 539 540 541 542 Last Page 538 of 2217