MaplePrimes Questions

The function

f := sin(x)/sqrt(2+sin(2*x));

has a simple elementary antiderivative but int(f,x) is huge and not elementary. What method would you suggest to find it?

restart;
with(plots):
with(geometry):
_EnvHorizontalName := x:
_EnvVerticalName := y:
R := 11:
r := 7:
a := sqrt(R*r):

b := 2:
circle(C1, [point(P1, [0, 0]), R]):
circle(C2, [point(P2, [R + 2*b + r, 0]), r]):
ellipse(p, (x - R - b)^2/b^2 + y^2/a^2 = 1):
draw([C1(color = yellow, filled = true), 
C2(color = red, filled = true), p(color = blue, filled = true), 
C1(color = black), C2(color = black), p(color = black)], 
axes = none, view = [-15 .. 35, -15 .. 15], scaling = constrained):
alpha := arctan((R - r)/(R + 2*b + r));
long := cos(alpha)*(R + 2*b + r);
evalf(%);
circle(C2, [point(P2, [long, r - R]), r]);
rotation(p1, p, alpha, 'clockwise');
detail(p1);
point(A, 0, -R);
point(B, long, -R);
line(L1, [A, B]);
point(cen, [(143*sqrt(5))/25, -(26*sqrt(5))/25]);
reflection(L2, L1, cen);
detail(L2);
Error, (in geometry:-reflection) unable to compute coeff
Error, (in geometry:-detail) unknown object:  L2

draw([C1(color = yellow, filled = true), C2(color = red, filled = true), p1(color = blue, filled = true), C1(color = black), C2(color = black), p1(color = black), L1(color = black)], axes = none, view = [-15 .. 35, -15 .. 15], scaling = constrained);
A Bug in reflection ? Why these error messages. Thank you.

Given

expr:=c[2]*sin(sqrt(3)*x/2) + c[3]*cos(sqrt(3)*x/2);
expr:=convert(expr,tan);

How to change the second result above (with the tan) back the the original form it was in?

I tried all different convert and simplification commands, and non managed to get back the original form.

convert(expr,sincos);
simplify(expr,size);
#etc...

Maple 2022.1 on windows 10

From an equation list originating from code optimization, a set of parameters and intermediate variables `tx` (where x is an integer) can be extracted.

{la, ra, rb, t, t10, t11, t12, t13, t15, t17, t18, t19, t21, t23, t24, t25, t26, t27, t28, t31, t32, t33, t34, t35, t36, t37, t39, t41, t42, t43, t44, t45, t46, t48, t49, t5, t50, t52, t53, t54, t55, t56, t57, t58, t59, t61, t62, t63, t64, t65, t67, t68, t69, t7, t70, t9, xa, za}

{la, ra, rb, t, t10, t11, t12, t13, t15, t17, t18, t19, t21, t23, t24, t25, t26, t27, t28, t31, t32, t33, t34, t35, t36, t37, t39, t41, t42, t43, t44, t45, t46, t48, t49, t5, t50, t52, t53, t54, t55, t56, t57, t58, t59, t61, t62, t63, t64, t65, t67, t68, t69, t7, t70, t9, xa, za}

(1)

 

To extract from this list the intermediate variables for further processing I do

with(StringTools); intermediates := NULL; for i in {la, ra, rb, t, t10, t11, t12, t13, t15, t17, t18, t19, t21, t23, t24, t25, t26, t27, t28, t31, t32, t33, t34, t35, t36, t37, t39, t41, t42, t43, t44, t45, t46, t48, t49, t5, t50, t52, t53, t54, t55, t56, t57, t58, t59, t61, t62, t63, t64, t65, t67, t68, t69, t7, t70, t9, xa, za} do if `and`(is(FirstFromLeft(convert(i, string), t) = 1), type(parse(convert(i, string)[2]), integer)) then intermediates := intermediates, i end if end do

{intermediates}

{t10, t11, t12, t13, t15, t17, t18, t19, t21, t23, t24, t25, t26, t27, t28, t31, t32, t33, t34, t35, t36, t37, t39, t41, t42, t43, t44, t45, t46, t48, t49, t5, t50, t52, t53, t54, t55, t56, t57, t58, t59, t61, t62, t63, t64, t65, t67, t68, t69, t7, t70, t9}

(2)

NULL

Quite some code for a little task. Can this be done more efficiently?

Download extract_tx.mw

I want to change the colors of a contour such that the region above zero is represented by a different color instead of yellow color,  and that the colors for conts <0 are one set of colors (maybe yellow to red), and the area for which conts >0 is one color which is very different from the others (so maybe white).

Case4Contour.mw

Hi!

I am doing some vector calculations with maple 2022, and I would like to gain a better understanding of how spherical derivatives of spherical vectors are calculated.  How can I ask maple to show the solution for this calculation?

spherical_derivatives.mw

Thanks in advance!

I want to use union, intersection and minus to find. Help me

I have a whole lot of conditions to test on the signum of answers. This gets difficult to read so I am wondering could something like the following be done?

a, b, c, d := 1, -1, 1, -1;
if a, b, c, d = 1, 0, -1, -1 then
    print("foo");
end if;

The above obviously doesn't work. The reason I would like to do this is it would be simple to read the patterns of 1's and 0's.

Any ideas?

matrix_inverse.mw

Here attached is my script. The execution of the worksheet gets stuck at the MatrixInverse(M) step. What do you suggest in order to speed up the computation?

As you can see, my matrix M is a 3x3 symmetric matrix, but quite convoluted. Eventually, I need to multiply the resulting inverse by another (row) vector.

Thank you for looking into this!

Hello. There is some system of differential equations with respect to the unknowns u1(x), u2(x), u3(x) with boundary conditions. Solved numerically using the dsolve command.
Is it possible to build a graph of a function of the form W=a*u1(x)+b*u2(x)+c*u3(x) based on this solution?

Thank you for your answers.

This seems like a very simple questaion, but I have been spinning my wheels trying to find the answer.

Is there a single command the will return a list of all symbols used in a symbolic expression?

Thank you, David

I want to check whether the last expression is zero symbolically in maple. I am trying to learn how to calculate symbolically in Maple. Any suggestion would be very appreciated.


restart;

with(Physics);
with(Physics[Vectors]);

[`*`, `.`, Annihilation, AntiCommutator, Antisymmetrize, Assume, Bra, Bracket, Check, Christoffel, Coefficients, Commutator, CompactDisplay, Coordinates, Creation, D_, Dagger, Decompose, Define, Dgamma, Einstein, EnergyMomentum, Expand, ExteriorDerivative, Factor, FeynmanDiagrams, FeynmanIntegral, Fundiff, Geodesics, GrassmannParity, Gtaylor, Intc, Inverse, Ket, KillingVectors, KroneckerDelta, LeviCivita, Library, LieBracket, LieDerivative, Normal, NumericalRelativity, Parameters, PerformOnAnticommutativeSystem, Projector, Psigma, Redefine, Ricci, Riemann, Setup, Simplify, SortProducts, SpaceTimeVector, StandardModel, SubstituteTensor, SubstituteTensorIndices, SumOverRepeatedIndices, Symmetrize, TensorArray, Tetrads, ThreePlusOne, ToContravariant, ToCovariant, ToFieldComponents, ToSuperfields, Trace, TransformCoordinates, Vectors, Weyl, `^`, dAlembertian, d_, diff, g_, gamma_]

 

[`&x`, `+`, `.`, ChangeBasis, ChangeCoordinates, Component, Curl, DirectionalDiff, Divergence, Gradient, Identify, Laplacian, Nabla, Norm, Setup, diff]

(1)

 

 

 

H[s]:=sum(Norm(p_[n])^2/2/m+U(q_[n]),n=1..s)+(1/2)*sum(sum(V(q_[i]-q_[j]),j=i..s),i=1..s);

sum((1/2)*Physics:-Vectors:-Norm(p_[n])^2/m+U(q_[n]), n = 1 .. s)+(1/2)*(sum(sum(V(q_[i]-q_[j]), j = i .. s), i = 1 .. s))

(2)

H[N-s]:=sum(Norm(p_[n])^2/2/m+U(q_[n]),n=s+1..N)+(1/2)*sum(sum(V(q_[i]-q_[j]),j=s+1..N),i=s+1..N);

sum((1/2)*Physics:-Vectors:-Norm(p_[n])^2/m+U(q_[n]), n = s+1 .. N)+(1/2)*(sum(sum(V(q_[i]-q_[j]), j = s+1 .. N), i = s+1 .. N))

(3)

 

 

Download Ch3.mw
 

 

 

 

I do not remember is this was asked before.

In other OOP languages such as Java, it allows one to name object variable name same as method name. I found this example on the net for java to illustrate

class Test {

  private boolean isVal;

  public boolean isVal() {
      return isVal;
  }

}

In Maple, this is not allowed. So now I have to come up with new name for either the method or the variable that returns that hidden internal variable.

Here is an example

A:=module()
  option object;
  local is_valid::truefalse:=false;
  export is_valid::static:=proc(_self,$)::truefalse;
    return _self:-is_valid;
  end proc;
end module;

THis gives error

Error, (in A) exported variable `is_valid` cannot be multiply declared

It will be nice if Maple allows this. For now one has to rename either the variable or the method. Which is little annoying.

Is this something that could  be easily added to Maple in a future release?

I changed today my code to use DEtools:-odeadvisor(ode,y(x),[linear]); to check that the ode is linear or not before calling DEtools:-convertAlg 

The problem is that sometimes the advisor returns _linear on what is not linear ode (at least the way it is originally written). Here is an example

              (x+y(x))*diff(y(x),x) = 0;

From help page:

 

In the event that convertAlg cannot isolate for the proper list form (for instance, if the DE is not a linear ODE) then FAIL is returned.

 

So now I am worried  that using odeadvisor to check for linear ode is not the right method.

Is there a build-in method in Maple to check if an ode is linear or not? (I do have my own code to do this, but I thought it is better to use a buildin method, as it will be more robust).

Should DEtools:-odeadvisor(ode,y(x),[linear]) have returned _linear in this case?

interface(version);

`Standard Worksheet Interface, Maple 2022.1, Windows 10, May 26 2022 Build ID 1619613`

ode:=(x+y(x))*diff(y(x),x) = 0;
DEtools:-odeadvisor(ode,y(x));
#check if linear ODE
DEtools:-odeadvisor(ode,y(x),[linear]);

(x+y(x))*(diff(y(x), x)) = 0

[_quadrature]

[_linear]

DEtools:-convertAlg(ode,y(x));

FAIL

 

Download why_fail_sept_17_2022.mw

In the website https://en.wikipedia.org/wiki/Geodesic there is an animation of an insect tracing a path on a torus while walking "forward". The caption to the animation says that the path is then by definition a geodesic.

I would like to duplicate this animation in Maple (and other "walking forward" geodesics on other surfaces) which seems to require an exact definition of walking forward but I cannot find such a definition on this or any other website.

Also, I thought that a geodesic is the shortest distance between two points in space, but no such end points are shown in the website's animation. Then how can the word geodesic apply to the insect's path?

First 158 159 160 161 162 163 164 Last Page 160 of 2308