Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

The command "if x+x=2*x then print(1) else print(0) fi" gives the output 1. Similarly for

x*x=x^2. But "if (x+1)^2=x^2+2*x+1 then print(1) else print(0) fi" gives 0. I suppose that this isn't considered a bug, but could someone explain the rationale behind it? How does one get this type of command to behave in what I would consider the intuitive way?

Hi. i want to create a list of n random 0 and 1 numbers with x numbers equal to 1 and n-x number equal to zero.
for example in the code below, i have produced n=100 numbers of 0 and 1. But i want to create a proc that takes x as an input and generates this list with specified number of x numbers 1 and n-x numbers zero randomly. thanks for the help
 

restart:with(RandomTools):

n:=100

100

(1)

A:=[seq](Generate(choose({0, 1})),i=1..n)

[0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0]

(2)

 

 

 


 

Download problem.mw

The command

plot(x^(1/3), x = -10 .. 10)

plots only the points where x>=0, as for negative values of x the cubic root retuns only the complex root.

Ca can I modify it so that it returns only the real root, so that the whole plot can be viewed?

Hi,

is there fix for the following quirk in the Maple 2023 editor:

randomly (hours, days) some characters change their appearance like p.e. the = sign becomes d-bold or sigma becomes s-bold. I have never experienced this in previous versions.

Thanks in advance.

Why does  int(x^17*cos(x^6), x) yields the complex form

-(x^12 + 2*I*x^6 - 2)*exp(x^6*I)*I/12 + (x^12 - 2*I*x^6 - 2)*exp(-I*x^6)*I/12

instead of the real (and more straightforward) answer

x^12/6*sin(x^6) + x^6/3*cos(x^6) - sin(x^6)/3

Both are equivalent, and the second form can be achieved from the first one by aplying Euler's identity.

However, how can I force int to yield the second form (real)?

First, this is not a homework assignment.  I am evaluating Maple as a replacement for a paper notebook since I never seem to have one at hand when I want one.  I want to be able to do algebra but seemingly at a finer level of detail than factor, collect, simplify, and expand seem to offer.  Here is what seems like a very simple example that I cannot crack:

(x-a)2-2a(x-a)

should simplify to 

x2 - a2

No matter what try with factor, collect, simplify, sort, and expand, I cannot get it past

x2 - 2xa + a2 + 2a(x - a)

How can I get maple to expand and collect specific terms in an expression?

Hi, maybe someone knows how to fix this:

"Error, (in assuming) when calling 'assume'. Received: 'question.mw'"

I am attaching the corresponding maple file. I've never met such an error message, and unfortunately the Maplesoft help does not contain any information about such an issue : 

restart; (2^(1/2+1/2+1)*GAMMA(n+1/2+1)*GAMMA(n+1/2+1))/((2*n+1/2+1/2+1)*GAMMA(n+1/2+1/2+1)*factorial(n))

4*GAMMA(n+3/2)^2/((2*n+2)*GAMMA(n+2)*factorial(n))

(1)

JacobiP(n, 1/2, 1/2, 1)

JacobiP(n, 1/2, 1/2, 1)

(2)

evalf(JacobiP(3, 1/2, 1/2, 1))

2.187500000

(3)

f := proc (n, x) options operator, arrow; (1/4)*JacobiP(n, 1/2, 1/2, x)*4^(1/2)/(GAMMA(n+3/2)^2/((2*n+2)*GAMMA(n+2)*factorial(n)))^(1/2) end proc

proc (n, x) options operator, arrow; (1/4)*JacobiP(n, 1/2, 1/2, x)*4^(1/2)/(GAMMA(n+3/2)^2/((2*n+2)*GAMMA(n+2)*factorial(n)))^(1/2) end proc

(4)

int(f(1, x)^2*sqrt(-x^2+1), x = -1 .. 1)

1

(5)

int(f(2, x)^2*sqrt(-x^2+1), x = -1 .. 1)

1

(6)

int(f(3, x)^2*sqrt(-x^2+1), x = -1 .. 1)

1

(7)

c := proc (n) options operator, arrow; int(sqrt(1+x)*f(n, x)*sqrt(-x^2+1), x = -1 .. 0)+int(f(n, x)*sqrt(-x^2+1), x = 0 .. 1) end proc

proc (n) options operator, arrow; int(sqrt(1+x)*f(n, x)*sqrt(-x^2+1), x = -1 .. 0)+int(f(n, x)*sqrt(-x^2+1), x = 0 .. 1) end proc

(8)

c(12)

(2/450225)*(-208+679*2^(1/2))/Pi^(1/2)

(9)

S := proc (N, x) options operator, arrow; evalf(sum(c(n)*f(n, x), n = 0 .. N)) end proc

proc (N, x) options operator, arrow; evalf(sum(c(n)*f(n, x), n = 0 .. N)) end proc

(10)

S(1, 1)

Error, (in assuming) when calling 'assume'. Received: 'contradictory assumptions'

 

NULL

Download question.mw

https://www.maplesoft.com/support/help/errors/view.aspx?path=Error,%20(in%20assuming)%20when%20calling%20%27assume%27.%20Received%3A%20%27contradictory%20assumptions%27

Many thanks in advance

> ode_sys:=2*diff(x(t),t$2) + 6*x(t) - 2*y(t) = 0, diff(y(t),t$2) + 2*y(t) - 2*x(t) = 0:
> lsol:=inttrans:-laplace({ode_sys},t,s)

The displayed output has an unresolved  "=  inttrans/laplace`(0, t, s)" on the end.

> lsol

Does not. Why?

A general term for this series is+-xr, having a positive sign when r is even and a negative sign when r is odd.

​​​​Now because (-1) is positive when r is even and negative when r is odd, the general term can be written as (-1)rxr

Hence;

1-x+x2-x3+...=£or=0(-1)r(x)r

Why does fsolve(x - (-8.0)^(1/3), x) returns only the first root (1.000000000 + 1.732050807*I)  of the polynomial (which clearly has 3 roots)?

I am re-posting. I am not sure why my question was deleted. Please advise on how to amend my post so that it's not considered spam.

I simply wonder how parameters can "disappear" in a solution. In particular, in my example below the parameter gamma correctly appears in 3 out of 4 solution. However, the solution in which 'gamma' does not appear is also the solution I am most interested in, given its manageable size. Why gamma is "lost" for this solution? 281223_gamma_disappear.mw

Dear power users, I am still struggling with relative simple tasks and do hope that some of you can help me in the right direction. Solving an ODE is straightforward in Maple. But how do you solve an ODE with multiple inputs, as shown in the attached worksheet. I would appreciate any help with respect to my question. I would also like to wish all of you a good ending of 2023 and a brilliant start in 2024.

MapleprimesODE_Question.mw

Hi, will happy to find out how can I get the proper answer for the expression following:

abs(exp(I*k*x))?

I expected to get 1

Bu actually I've got

e^R(Ikx)

Futhermore, Maple also doesn't calculate any absolute values of complex expressions, only adds the brackets.

in this plot...i want to do like only 5 points in y coordinates and x coordinates...how to change? there are many

For example, I would like to draw the following figure in Maple.

 

(The above figure is taken from MatLab's documentation.) 
Here are these four graphics objects: 

use plottools, ColorTools in
	l0, l1 := line~([<1 | 0>, <1 | 1>], [<6 | 5>, <6 | 6>], 'color' =~ Color~(["#0072BD", "#D95319"]))[];
	r0, r1 := rectangle~([[2, 0], [4, 0]], [[3, 6], [5, 6]], 'color' =~ Color~([[.6, .7, .9], [.95, .7, .6]]))[]
end:

However, either 

`plots/display`([r1, l1, l0, r0], 'axes' = "boxed", 'size' = ["default", "golden"], 'style' = "patchnogrid")

or 

`plots/display`([r0, l0, l1, r1], 'axes' = "boxed", 'size' = ["default", "golden"], 'style' = "patchnogrid")

outputs the same graphical image where the lines are always rendered on top of each rectangles instead of the other way around.

plots:-display([plottools:-rectangle([2, 0], [3, 6], 'color' = ColorTools:-Color([.6, .7, .9])), plottools:-line([1, 0], [6, 5], 'color' = ColorTools:-Color( 

So how to superimpose the right rectangle over the two lines? To put it differently, how to handle the graphics hierarchy? I have read some similar questions like Order in plots:-display - MaplePrimes, yet I cannot find any workarounds. 

Note that in my opinion, the result should comprise two unbroken line segments rather than four subordinate line segments! 

First 21 22 23 24 25 26 27 Last Page 23 of 2097