MaplePrimes Questions

Hello,

Best wishes for this new year.

Horner's algorithm for polynomials is considered more efficient in terms of the number of operations.
However, numerous comparisons (search for real or complex roots, calculations of hundreds of values...)
with Maple on polynomials of high degrees (10,12...) show, for me, no significant difference in times of execution evaluated with the st-time() command.

Has this point already been covered?
Are there specific situations where using the "horner" conversion is relevant with Maple?

Thank you for your clarification.

Best regards.

Let M a block matrix, for instance:

restart:
S := [a, b, c, d]:
M := Matrix(2$2, (i, j) -> Matrix(2$2, symbol=S[2*(i-1)+j]))

It is quite simple to transform M into a 4x4 Matrix P with elements 

P[1, 1] = a[1, 1], P[1, 2] = a[1, 2], P[1, 3] = b[1, 1], ..., P[4, 4]= d[2, 2]

But does it exist a built-in Maple function which does this "unfolding"?

Thanks in advance

Something happens when I redefine an indexed value of a table, but I'm not sure what.

Here's the situation before the definition.

eval(WhateverYouNeed["calculations"]["structure"]["connection"]);


TABLE(["Cutright1" = "false", "graindirection1" = 90 Unit(arcdeg), "Cutleft2" = "false",  "lengthleft2" = 500 Unit(mm), "Cutrightsteel" = "false", "lengthleftsteel" = "false", "lengthleft1" = 350 Unit(mm), "lengthright2" = 500 Unit(mm), "connection_1" = "Timber", "lengthrightsteel" = "false", "connection_2" = "Timber", "Cutleft1" = "false", "Cutleftsteel" = "false", "graindirection2" = 0, "graindirectionsteel" = "false", "Cutright2" = "false", "lengthright1" = 150 Unit(mm), "connection_InsideLayers" = 1])

I then try to redefine one specific entry of the table.
WhateverYouNeed["calculations"]["structure"]["connection"]["connection_1"] := GetProperty("ComboBox_connection_1", 'value');

WhateverYouNeed["calculations"]["structure"]["connection"]["connection_1"] := "Timber"

Which gives this new result.

eval(WhateverYouNeed["calculations"]["structure"]["connection"]);


TABLE(["connection_1" = "Timber"])

The rest of the indices and entries of the "connection" table is gone.

I am looking for something like that but in 3d.

My question is twofold:

- What, in general, are "good" ways to do this? I am surprised that I haven't found anything better than the Boing Ball. Patterns of billard balls might be an alternative if the balls are well oriented at the start of an animation/simulation.

- How can spheres be patterned in Maple? I looked at: plots,obsolete,sphereplot(deprecated), plottools,sphere, and plots,conformal and MaplePrimes for examples but did not find anything to build on. 

Patterns that might not be too complicated to implement:

  • globe with meridians and chessboard pattern,
  • ball with a punched belt,
  • ball with 2 or 3 crossed belts
  • ...

Any thoughts on this topic?

Update: Change of orientation of the angular velocity while the sphere is spinning is an important visualisation aspect. I added this to the title.

I've reported this to Maplesoft 6 months ago.

I was wondering if someone with beta version of 2024 could check if these are fixed? (if one is allowed to do so). As these errors keep breaking my program. (not possible to trap).

436

interface(version);

`Standard Worksheet Interface, Maple 2023.2, Windows 10, November 24 2023 Build ID 1762575`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1637 and is the same as the version installed in this computer, created 2023, November 29, 17:28 hours Pacific Time.`

ode:=diff(y(x),x) = (x*y(x)+x^3+x*y(x)^2+y(x)^3)/x^2;
sol:=exp(3*sum(1/(9*_R^2-1)*ln((-_R*x+y(x)-1/3*x)/x),_R = RootOf(27*_Z^3-9*_Z+29)))-c__1*exp(x) = 0;
odetest(sol,ode);

diff(y(x), x) = (x*y(x)+x^3+x*y(x)^2+y(x)^3)/x^2

exp(3*(sum(ln((-_R*x+y(x)-(1/3)*x)/x)/(9*_R^2-1), _R = RootOf(27*_Z^3-9*_Z+29))))-c__1*exp(x) = 0

Error, (in simplify/RootOf) too many levels of recursion

ode:=diff(u(x),x)-1/2*(2*a*u(x)^3+u(x)+2*b)/x = 0;
sol:=2*sum(1/(6*_R^2*a+1)*ln(u(x)-_R),_R = RootOf(2*_Z^3*a+_Z+2*b))-1/2*ln(x)-_C1 = 0;
odetest(sol,ode);

diff(u(x), x)-(1/2)*(2*a*u(x)^3+u(x)+2*b)/x = 0

2*(sum(ln(u(x)-_R)/(6*_R^2*a+1), _R = RootOf(2*_Z^3*a+_Z+2*b)))-(1/2)*ln(x)-_C1 = 0

Error, (in simplify/RootOf) too many levels of recursion

 

Download in_simplify_rootof_too_many_level_of_recursion_jan_6_2024.mw

Is there any Maple command equivalent to Mathematica StreamPlot command?

Thank you.

I was about to update an older discussion with the information that the context pannel now contains an entry "Normalized Expanded".

I only remember that I was participating with another user.

So, I tried C_R AND other_user in the search field. This gives an error.

A space as an implict AND operator does also not work.

In previous versions of Maple for the Macintosh, I would often request output in LaTeX format and use the Maple.sty that Maplesoft provided. In the current version, I am unable to retrieve from my directory the current version for Maple.sty --- could someone please provide a link to the LaTeX Maple.sty file that I can incorporate into my output for LaTeX processing of Maple calculations? Many thanks, William

As I assumed 'n' and 'm' are real, eta is complex. But still, there is a bar on these discrete independent variables. Secondly, the substitution of (8) applies in some terms of 'r2', and the remaining terms remain as is it.

restart

with(LinearAlgebra); with(PDEtools); with(plots); with(LREtools)

setup(mathematicalnotation = true)

setup(mathematicalnotation = true)

(1)

assume(n::real); assume(m::real)

A := proc (n, m) options operator, arrow; Matrix([[eta*phi(n, m), conjugate(eta)*conjugate(psi(n, m))], [phi(n, m), conjugate(psi(n, m))]]) end proc; Adet := Determinant(A(n, m))

eta*phi(n, m)*conjugate(psi(n, m))-conjugate(eta)*conjugate(psi(n, m))*phi(n, m)

(2)

B := proc (n, m) options operator, arrow; Matrix([[phi(n, m), conjugate(psi(n, m))], [-psi(n, m), conjugate(phi(n, m))]]) end proc; Bdet := Determinant(B(n, m))

phi(n, m)*conjugate(phi(n, m))+conjugate(psi(n, m))*psi(n, m)

(3)

r := Adet/Bdet

(eta*phi(n, m)*conjugate(psi(n, m))-conjugate(eta)*conjugate(psi(n, m))*phi(n, m))/(phi(n, m)*conjugate(phi(n, m))+conjugate(psi(n, m))*psi(n, m))

(4)

p := {eta = 1+I, phi(n, m) = (1+I*a*eta)^n*(1+I*b*eta^2)^m, psi(n, m) = (1-I*a*eta)^n*(1-I*b*eta^2)^m, conjugate(eta) = 1-I, conjugate(phi(n, m)) = (1-I*a*conjugate(eta))^n*(1-I*b*conjugate(eta)^2)^m, conjugate(phi(n, m)) = (1+I*a*conjugate(eta))^n*(1+I*b*conjugate(eta)^2)^m}

{eta = 1+I, phi(n, m) = (1+I*a*eta)^n*(1+I*b*eta^2)^m, psi(n, m) = (1-I*a*eta)^n*(1-I*b*eta^2)^m, conjugate(eta) = 1-I, conjugate(phi(n, m)) = (1-I*a*conjugate(eta))^n*(1-I*b*conjugate(eta)^2)^m, conjugate(phi(n, m)) = (1+I*a*conjugate(eta))^n*(1+I*b*conjugate(eta)^2)^m}

(5)

r1 := simplify(subs(p, r))

(2*I)*(1+I*a*eta)^n*(1+I*b*eta^2)^m*conjugate((1-I*a*eta)^n*(1-I*b*eta^2)^m)/((1+I*a*eta)^n*(1+I*b*eta^2)^m*(1-I*a*conjugate(eta))^n*(1-I*b*conjugate(eta)^2)^m+abs(-1+I*a*eta)^(2*n)*abs(I*b*eta^2-1)^(2*m))

(6)

r2 := 1-I*delta(r1, n)

1-I*((2*I)*(1+I*a*eta)^(n+1)*(1+I*b*eta^2)^m*conjugate((1-I*a*eta)^(n+1)*(1-I*b*eta^2)^m)/((1+I*a*eta)^(n+1)*(1+I*b*eta^2)^m*(1-I*a*conjugate(eta))^(n+1)*(1-I*b*conjugate(eta)^2)^m+abs(-1+I*a*eta)^(2*n+2)*abs(I*b*eta^2-1)^(2*m))-(2*I)*(1+I*a*eta)^n*(1+I*b*eta^2)^m*conjugate((1-I*a*eta)^n*(1-I*b*eta^2)^m)/((1+I*a*eta)^n*(1+I*b*eta^2)^m*(1-I*a*conjugate(eta))^n*(1-I*b*conjugate(eta)^2)^m+abs(-1+I*a*eta)^(2*n)*abs(I*b*eta^2-1)^(2*m)))

(7)

exp_expr := subs({(1+I*b*eta^2)^m = exp(I*eta^2*t)}, r2)

1-I*((2*I)*(1+I*a*eta)^(n+1)*exp(I*eta^2*t)*conjugate((1-I*a*eta)^(n+1)*(1-I*b*eta^2)^m)/((1+I*a*eta)^(n+1)*exp(I*eta^2*t)*(1-I*a*conjugate(eta))^(n+1)*(1-I*b*conjugate(eta)^2)^m+abs(-1+I*a*eta)^(2*n+2)*abs(I*b*eta^2-1)^(2*m))-(2*I)*(1+I*a*eta)^n*exp(I*eta^2*t)*conjugate((1-I*a*eta)^n*(1-I*b*eta^2)^m)/((1+I*a*eta)^n*exp(I*eta^2*t)*(1-I*a*conjugate(eta))^n*(1-I*b*conjugate(eta)^2)^m+abs(-1+I*a*eta)^(2*n)*abs(I*b*eta^2-1)^(2*m)))

(8)

``

NULL

NULL

NULL

plot3d(abs(exp_expr), n = -5 .. 5, t = -5 .. 5, eta = 1+I)

Error, (in plot3d) unexpected option: eta = 1+I

 
 

Download soldis.mw

Maple dsolve allows one to specify the algorithm to use to solve the ode. But sometimes it is very tricky to figure the syntax,

This ode 

ode:=diff(y(x),x)*y(x)+a*x*y(x)+b*x^3=0;
DEtools:-odeadvisor(ode);

Gives

               [[_homogeneous, `class G`], _rational, [_Abel, `2nd type`, `class A`]]

I wanted now to call dsolve telling dsolve to use the first method above. But how? All the following syntax failed for me

sol:=dsolve(ode,['_homogeneous, `class G`']);
sol:=dsolve(ode,'[_homogeneous, `class G`]');

All return method not found .

I am sure I am using wrong syntax but do not know what the correct one should be.

infolevel[dsolve]:=5;
sol:=dsolve(ode);

gives

Methods for first order ODEs:
--- Trying classification methods ---
trying a quadrature
trying 1st order linear
trying Bernoulli
trying separable
trying inverse linear
trying homogeneous types:
trying homogeneous G
<- homogeneous successful

With long solution printed now OK. 

When using just '[homogeneous]' it works

sol:=dsolve(ode,'[homogeneous]');

It gives same solution as default case.

What is the correct syntax to tell dsolve to use specific method [_homogeneous, `class G`] ? i.e. I need to add class G

The reason I ask is becuase Maple have different kind of homogeneous method as described here

Maple 2023.2.1 on windows 10

restart;
with(LinearAlgebra);
b := Matrix(3, 6, [[-1/2, 0, 1/2, 0, 0, 0], [0, 0, 0, -1/2, 0, 1/2], [0, -1/2, -1/2, 1/2, 1/2, 0]]);
i want  to show like this

Hi,

How i can generate sequence of greek letters like this with latin letters
seq(convert(StringTools[Char](k),name),k=97..122);

Thank you

Hello everyone,

I've encountered a problem with a piece of code involving an integral that should theoretically yield an exact solution. However, when running the code in Maple, I'm not getting the expected output

compute_integral.mw

Your assistance in resolving this matter would be greatly appreciated.

Thank you for your help.

It seems that applyrule cannot handle variable numbers of arguments, and I cannot use something like 

applyrule(f(u::anything, v::seq(anything)) = g(v, u), [f(x, y, z), f(x, y, z, t)]);
 = 
                  [f(x, y, z), f(x, y, z, t)]

Strangely, Maple does support the identical patterns in parameter declarations: 

eval([f(x, y, z), f(x, y, z, t)], f = ((u::anything, v::seq(anything)) → g(v, u)));
 = 
                  [g(y, z, x), g(y, z, t, x)]

So the two designs do not appear coherent. Should this be regarded as a "bug" in a sense? 

Of course there is no need to use the  modifier; here it is enough to use 

evalindets([f(x,y,z),f(x,y,z,t)],'specfunc'(anything,f),w->g(op(2..(),w),op(1,w))):
use f = MakeFunction('g(args[2 .. ], args[1])') in [f(x, y, z), f(x, y, z, t)] end:
use f = unapply('g(_rest, _w)', [_w::anything]) in [f(x, y, z), f(x, y, z, t)] end:

But the problem is, why is there such inconsistency described above? 

Given equation 

We see this can be simplified to 

In Mathematica, I just need to tell it the denominator of the left side is not zero for it to do the simplification

The same thing in Maple did not work:

eq:= (y-2*x)^3/( (y-x)^2 * x ) = a/x;
the_denom:= denom(lhs(eq));
simplify(eq) assuming the_denom <>0

No change. 

I am doing this in code not by looking at the screen and simply wanted to eliminate common terms on both sides of equation. I can in code obtain the denominator of the LHS and RHS and add assumption. But since I do not know what if any common terms are on both sides, it is not easy to use elminate.

I see code at https://www.mapleprimes.com/questions/227043-How-To-Automatically-Cancel-Any-Common which actually worked on this and it did automatically elminate x from both sides.

But my question is: why Maple does not do it using simplify with the assumption given?  Tried simplify with size and no change.

I am looking for the simplist method to elminate common terms on both sides of equation. Is the link above the only way to do this in Maple? May be there is something simpler in recent Maple versions?


#code from https://www.mapleprimes.com/questions/227043-How-To-Automatically-Cancel-Any-Common

restart;

eq:= (y-2*x)^3/( (y-x)^2*x) = a/x;
TT := simplify(expand((eq)),size):
if lhs(TT)::`*` and rhs(TT)::`*` then
  TTT := map[2](map,freeze,TT);
  comm := `*`(op({op(lhs(TTT))} intersect {op(rhs(TTT))}));
  new := simplify(thaw(lhs(TTT)/comm=rhs(TTT)/comm));
end if:
new

May be this should be part of Maple build in functions and used by simplify? 

Update 

I just hit on a way to do this automatically with no assumption of anything. The idea is to simply rewrite the equation, like this

restart;

eq:= (y-2*x)^3/( (y-x)^2 * x ) = a/x;
numer(lhs(eq))*denom(rhs(eq)) /  (denom(lhs(eq)) *numer(rhs(eq)))=1;

You see, the common term on both sides is automatically gone!   I need to test this more. 

To moderator: if you think this question is duplicate, feel free to delete it.

First 20 21 22 23 24 25 26 Last Page 22 of 2308