MaplePrimes Questions

Can MapleSim simulate a situation where a cable passes through a hole in an object, where the cable is constrained by the hole and the object also experiences forces from the cable because of the hole?

How would I solve for the product of two terms ( s*V or s^2*V). This is a simple example but I would be applying this on much higher order equations.

     V = Vx/(a*s^2 + b*s + c)

How do i retrieve the expression fra a "Fit" command so that i can use the expression for later calculations.

As you can see from the picture below, i use the "Fit" command to find an expression based on the values specified in X and Y. From there i would like to use the expression to find points on the line and to automate the proces. I can succesfully retrieve the expression by using the reference label, but is there another way to retrieve the expression so that i can avoid having to display the expression after evaluating?

I guess the question can be rephrased to: How do i retrieve the same information as the label reference does, but with a command and without using a label reference?

Hello, 

What would be the procedure to find the eigenvalues for a coupled harmonic oscillators characterized by eigenvalue E1 and E2? Are they treated as parameters in the numerical solution of the system of ode?

thanks in advance 

Hello,

I am having problems using RowEchelonTransform from the LinearAlgebra[Modular] package. According to the documentation, it returns a triple

Q,rp,d:=LinearAlgebra[Modular][RowEchelonTransform](p, M, false, false, false, false):

where Q and rp are vectors of length r=rank(M). In more detail, rp=[c1,...,cr] lists the (linearly independent) pivot columns, and Q is a list of transpositions that can be used to construct the pivot rows (denoted by the matrix P in the documentation).

Anyway, these details are not so important. My problem is that Q is not always a list of length r. The example

p:=29:
M:=LinearAlgebra[Modular][Mod](p, [[-1,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,-1,-1,-1,-1],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,-1,-1,1,1,1,1],[0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,-1,0,0,0,1],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,-1],[0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0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 10, 11, 10, 14, 15, 12, 15, 16, 16]
rp=[1, 2, 3, 4, 5, 8, 9, 10, 11, 15, 16, 18, 19, 22, 29, 34]

where rp has 16 elements as expected, but Q has only 15 elements.

Hence there is either a bug in RowEchelonTransform, or the documentation of its output is inaccurate.

I reported this to technical support (the Software Change Request Form on MaplePrimes sadly does not work and shows an error when I tried to submit the filled form).

In the meantime, does anyone know a workaround for this?

With thanks,

Erik

Since (1/h)[f(i+1,t)-f(i,t)]=f(x,t)_{x} as h goes to zero, 'i' is the discrete index along x-axis. How to do it in Maple? How to reduce Eq. (5) into continuous derivatives?

restart

with(LinearAlgebra)

with(PDEtools)

with(Physics)

with(plots)

Setup(mathematicalnotation = true)

[mathematicalnotation = true]

(1)

``

U := proc (i, t) options operator, arrow; Matrix([[1+I*(q(i+1, t)-q(i, t))/lambda, I*(r(i+1, t)-r(i, t))/lambda], [I*(r(i+1, t)-r(i, t))/lambda, 1-I*(q(i+1, t)-q(i, t))/lambda]]) end proc

proc (i, t) options operator, arrow; Matrix([[1+Physics:-`*`(Physics:-`*`(I, q(i+1, t)-q(i, t)), Physics:-`^`(lambda, -1)), Physics:-`*`(Physics:-`*`(I, r(i+1, t)-r(i, t)), Physics:-`^`(lambda, -1))], [Physics:-`*`(Physics:-`*`(I, r(i+1, t)-r(i, t)), Physics:-`^`(lambda, -1)), 1-Physics:-`*`(Physics:-`*`(I, q(i+1, t)-q(i, t)), Physics:-`^`(lambda, -1))]]) end proc

(2)

``

V := proc (i, t) options operator, arrow; Matrix([[-((1/2)*I)*lambda, -r(i, t)], [r(i, t), ((1/2)*I)*lambda]]) end proc

proc (i, t) options operator, arrow; Matrix([[Physics:-`*`(Physics:-`*`(Physics:-`*`(Physics:-`*`(1, Physics:-`^`(2, -1)), I), lambda), -1), Physics:-`*`(r(i, t), -1)], [r(i, t), Physics:-`*`(Physics:-`*`(Physics:-`*`(1, Physics:-`^`(2, -1)), I), lambda)]]) end proc

(3)

NULL

z := diff(U(i, t), t)+U(i, t).V(i, t)-V(i+1, t).U(i, t)

Matrix(%id = 4525182530)

(4)

z11 := simplify(lambda*z[1, 1]/h, size) = 0

I*(r(i+1, t)^2-r(i, t)^2+(D[2](q))(i+1, t)-(diff(q(i, t), t)))/h = 0

(5)

NULL

Download limit.mw

Hi:

I am using solve(...,allsolutions)

and Maple is giving me the default "_Z1~" as part of the solution. No problem.

But when I go back and run the same statement again without a restart, it gives me "_Z2~" and my program fails because it is looking to substitute a value for "_Z1".

How do I reset the naming convention without restarting so I can get the same output each time I run the same statement. (BTW: The same thing happens with Veil where it increments the indices of the Veil symbol each time you run the same statement)..

Thank you.

When opening a new Worksheet I am given an option to start a new server. When I close said worksheet the server closes. With no worksheets open I can see "Server 2" is available. If use it to open a new worksheet and the close said worksheet, "Server 2" remains available. Is this normal? Is it actually available or is it just a display feature?

I am really confused by this behavior. Should the solution be different when calling dsolve(ode) vs. dsolve(ode,[x(t),y(t)]) where here ode is list of two coupled first order ode's?

Maple shows the solutions in reverse order in one case vs. the other. I do not see why adding [x(t),y(t)] should make x(t) solution now y(t)'s and y(t) solution now x(t)'s.  Here is an example

Here is worksheet. I just find the out changing very confusing. Should not the same solution for x(t) and y(t) remain the same regardless of adding the second option as list of not? What is the logic behaind this change or order, and how it one to know which is the correct one as they look different.

``

interface(version);

`Standard Worksheet Interface, Maple 2023.2, Windows 10, October 25 2023 Build ID 1753458`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1592 and is the same as the version installed in this computer, created 2023, November 27, 3:41 hours Pacific Time.`

restart;

20440

ode :=[diff(x(t), t) = (3*x(t))/2 + 2*y(t), diff(y(t), t) = x(t)/2 + y(t)]

[diff(x(t), t) = (3/2)*x(t)+2*y(t), diff(y(t), t) = (1/2)*x(t)+y(t)]

simplify(dsolve(ode,[x(t),y(t)]));

{x(t) = -(1/2)*c__2*(17^(1/2)-1)*exp(-(1/4)*(-5+17^(1/2))*t)+(1/2)*c__1*exp((1/4)*(5+17^(1/2))*t)*(17^(1/2)+1), y(t) = c__1*exp((1/4)*(5+17^(1/2))*t)+c__2*exp(-(1/4)*(-5+17^(1/2))*t)}

simplify(dsolve(ode));

{x(t) = c__1*exp((1/4)*(5+17^(1/2))*t)+c__2*exp(-(1/4)*(-5+17^(1/2))*t), y(t) = -(1/8)*c__2*(17^(1/2)+1)*exp(-(1/4)*(-5+17^(1/2))*t)+(1/8)*c__1*exp((1/4)*(5+17^(1/2))*t)*(17^(1/2)-1)}

#when using SET instead of LIST, then same solutions come out as above
simplify(dsolve(ode,{x(t),y(t)}));

{x(t) = c__1*exp((1/4)*(5+17^(1/2))*t)+c__2*exp(-(1/4)*(-5+17^(1/2))*t), y(t) = -(1/8)*c__2*(17^(1/2)+1)*exp(-(1/4)*(-5+17^(1/2))*t)+(1/8)*c__1*exp((1/4)*(5+17^(1/2))*t)*(17^(1/2)-1)}

 

Download why_solution_changes_nov_27_2023.mw

Is it possi le to ge a transfer function from a bode plot ?

How to plot this equation

 y(x):=

where,

A := Matrix([[1, -1, 1, -1], [1, 1, -1, -1], [-1, 1, 1, -1], [1, 1, 1, 1]]);
B := Matrix([[1], [0], [1], [0]])

I want to creat an interactive document for students. When user clicks in a coordinate-system a point shall come up. For this I need the relative (or absolute) coordinates of the actual mouse position. I cannot find the command for this. In other languages it is like getmousex, getmousey. Can anyone help, please?

As a part of my learning curve, I am trying to play with extending Maple's BernsteinBasis, which has only a limited support right now (BernsteinBasis - Maple Help (maplesoft.com)).

My goal is to implement basis operation on polynomials in Bernstein basis, so that derivatives, integrals and products of polynomials in  BernsteinBasis would be again expressed in BernsteinBasis.

While it looks like it is relatively easy to extend diff procedure, by using `diff/BernsteinBasis`, I didn't find anything similar for the int. Is there something like `int/BernsteinBasis`?

The problem is that when I am trying to implement my own int procedure in a module that  would extend standard int, it seems I need to manually implement logic for (at very least) linearity, so that int(p(x) + q(x), x) would decay into int(p(x), x) + int(q(x), x ) (I probably don't need more complex rewriting rules). So before trying this approach, is there any easy way such as with diff?
 

restart;

read("C:\\Users\\Igor\\Maple\\BernsteinPolynomials.mpl");

_m2141342686560

(1)

# General formula
diff(BernsteinBasis(k, n, a, b, x), x);

n*BernsteinBasis(k-1, n-1, a, b, x)/(b-a)-n*BernsteinBasis(k, n-1, a, b, x)/(b-a)

(2)

# In expressions
diff(2*x*BernsteinBasis(1, 2, 0, 1, x) + BernsteinBasis(2, 2, 0, 1, x), x);

2*BernsteinBasis(1, 2, 0, 1, x)+2*x*(2*BernsteinBasis(0, 1, 0, 1, x)-2*BernsteinBasis(1, 1, 0, 1, x))+2*BernsteinBasis(1, 1, 0, 1, x)

(3)

# Convertion to MatrixPolynomialObject works
p := diff(BernsteinBasis(1, 2, 0, 1, x) + BernsteinBasis(2, 2, 0, 1, x), x);
P := convert(p, MatrixPolynomialObject, x);
P:-Value(a);

p := 2*BernsteinBasis(0, 1, 0, 1, x)

 

P := Record(Value = Default[value], Variable = x, Degree = 1, Coefficient = coe, Dimension = [1, 1], Basis = BernsteinBasis, BasisParameters = [1, 0, 1], IsMonic = mon, OutputOptions = [shape = [], storage = rectangular, order = Fortran_order, fill = 0, attributes = []])

 

Matrix(%id = 36893490288797933188)

(4)

# Now, integrataion
with(BernsteinPolynomials);

[int]

(5)

# Still works
int(x^2, x);

(1/3)*x^3

(6)

# Not implemented but will be added later...
int(BernsteinBasis(1, 2, 0, 1, x), x);

"Will be implemented here..."

 

int(BernsteinBasis(1, 2, 0, 1, x), x)

(7)

# This is the problem: how to implement basis properties such as linearity?
int(2 * BernsteinBasis(1, 2, 0, 1, x), x);

int(2*BernsteinBasis(1, 2, 0, 1, x), x)

(8)

 

 

BernsteinPolynomials := module()
    description "Basic operations in Bernstein basis";
	option package;
	global BernsteinBasis, `diff/BernsteinBasis`;
	export int;

	BernsteinBasis := proc(k, n, a, b, x)
		description "Bernstein basis polynomial";
		if k::numeric then
			if k < 0 then 
				return 0;
			end if
		end if;
		if n::numeric then
			if n < 0 then 
				return 0; 
			end if;
			if k::numeric then
				if k > n then
					return 0;
				end if;
			end if;
		end if;
		'procname'(_passed)
	end proc;

	`diff/BernsteinBasis` := proc()
		description "Derivative of the Bernstein basis polynomial in the Bernstein basis";
		if _npassed = 6 then
			if _passed[-1] = _passed[-2] then
				_passed[2] * BernsteinBasis(_passed[1] - 1, _passed[2] - 1, _passed[3], _passed[4], _passed[5]) / (_passed[4] - _passed[3]) -
				_passed[2] * BernsteinBasis(_passed[1], _passed[2] - 1, _passed[3], _passed[4], _passed[5]) / (_passed[4] - _passed[3]);
			end if;
		end if;
	end proc;
	
	int := proc()
		description "Integral of the Bernstein basis polynomial in the Bernstein basis";
		if type(_passed[1], 'specfunc'(anything, BernsteinBasis)) then
		    print("Will be implemented here...");
		end if;
		:-int(_passed)
	end proc;

end module;

Download bernstein.mw

In my code, without knowing what the expression is, other than it has RootOf, the code called allvalues and got internal error 

Error, (in SolveTools:-Basis) invalid input: igcd received 5/7, which is not valid for its 2nd argument

Is this to be expected depending on the input, or is this some internal problem I need to report?

restart;
expr:=RootOf(R^4*b+R^2*a*_Z+2*_Z^2-exp(RootOf(tanh(1/2*(a^2-8*b)^(1/2)*(4*S-_Z)/a)^2*R^4*a^2-8*tanh(1/2*(a^2-8*b)^(1/2)*(4*S-_Z)/a)^2*R^4*b-R^4*a^2+8*R^4*b-8*exp(_Z))))

allvalues(expr)

Error, (in SolveTools:-Basis) invalid input: igcd received 5/7, which is not valid for its 2nd argument

Maple 2023.2 on windows 10

ps.  Reported to Maplesoft

To label axes, names with Maple typesetting tags can be used. This is convenient because the typesetting package does not have to be loaded and code is shorter. However, when used together with plot white spaces (mo(“ “)) sometimes do render. Below is an example where a white space after the character N is not rendered.

with(Typesetting):

ta:=Typesetting:-Typeset(`#mrow(mo("N "),mo("* "),msup(mo("mm"),mo("-2")))`)

Typesetting:-mrow(Typesetting:-mo("N "), Typesetting:-mo("* "), Typesetting:-msup(Typesetting:-mo("mm"), Typesetting:-mo("-2")), Typesetting:-msemantics = "atomic")

(1)

tb:=`#mrow(mo("N ",color="red"),mo("* "),msup(mo("mm"),mo("-2")))`

`#mrow(mo("N ",color="red"),mo("* "),msup(mo("mm"),mo("-2")))`

(2)

tc:=Typesetting:-Typeset(mrow(mo("N "),mo("* "),msup(mo("mm"),mo("-2"))))

Typesetting:-mrow(Typesetting:-mo("N "), Typesetting:-mo("* "), Typesetting:-msup(Typesetting:-mo("mm"), Typesetting:-mo("-2")))

(3)

plot(x,x=1..10,labels=[ta,tb],title=tc)

 

NULL

A workarround is adding an addtional tag mspace() or an invisible html character. Are there any others?

Since typesetting of normal Maple output shows the whitespace I am wondering if this way of plotting axis labels is intended. 

Download Typesetting_white_space.mw

First 96 97 98 99 100 101 102 Last Page 98 of 2374