MaplePrimes Questions

Hi,

 

How do we remove the module name functions that massively pollute the output after using with(Units[Standard]):

So that I can have something presentable like this :

Thanks!

Dear sir, I request to suggest the method for the following posted question.

 

How to find a rational function with give real roots 1,2,3  and oblique asymptote y=2-x?

Based on an answer to a question posted on MaplePrimes, which I am I able to locate through the search system, but that I know it is recent, I am trying to calculate the parameters of a function which minimizes the result of a numerical integral. The function, f1(x), is well defined. The function f2(x) has two parameters, K and r. The integral of the square of the difference between the two function cannot be solved symbolically. Hence my plan is to use the Minimization function in Optimization to determine the values of K and r. 

The attached worksheet includes two examples - a practice example for me to become familiar with using Optimization:-Minimization for an integral and the actual problem I am attempting to solve. Note: it was only through MaplePrimes that I learned the function must be defined through a procedure. Here is what I discovered in my experiments:

* the command to perform the numerical integration requires the small "i" verion of int, not Int, i.e evalf( int( function, limits )), not evalf(Int(..)).  This seems to be inconsistent with the documentation. Can someone explain why it is this way?

* The function must be defined locally. If I try to use a globally defined function, non-numeric results are encountered. Is there a way to integrate a global function?

* For the practice problem, it works as long as I abide by the conditions in the previous 2 bullet points.

* When I try to solve the real problem, which appears to be solvable by eyeballing some graphs (included), the kernal is lost.  This is repeatable for me. Do others experience this problem?

Thank you for your attention.

-------------------

Aside: It would be useful if the output of a search in MaplePrimes could be sorted by date.

 MaplePrimes_Minimization.mw

Hi, can someone explain me why CodeGeneration in C throws the error : Error, (in Print) improper op or subscript selector ? Interestingly, CodeGeneration in Python or Matlab works. Source code is attached. Thanks in advance!

membrane_energy.mw
 

 

Membrane Energy

 

restart; with(VectorCalculus); with(LinearAlgebra); with(CodeGeneration)

Define variables

 

Vectors for vertices of current position

v1 := Vector(3, symbol = v1_i) = Vector[column]([[v1_i[1]], [v1_i[2]], [v1_i[3]]], ["x", "y", "z"]) 

v2 := Vector(3, symbol = v2_i) = Vector[column]([[v2_i[1]], [v2_i[2]], [v2_i[3]]], ["x", "y", "z"])NULL

v3 := Vector(3, symbol = v3_i) = Vector[column]([[v3_i[1]], [v3_i[2]], [v3_i[3]]], ["x", "y", "z"])NULL

n := `&x`(v2-v1, v3-v1)

v4 := v1+n/norm(n, 2)^.5

Vector for vertices of next position

v1n := Vector(3, symbol = v1n_i) = Vector[column]([[v1n_i[1]], [v1n_i[2]], [v1n_i[3]]], ["x", "y", "z"])NULL

v2n := Vector(3, symbol = v2n_i) = Vector[column]([[v2n_i[1]], [v2n_i[2]], [v2n_i[3]]], ["x", "y", "z"])NULL

v3n := Vector(3, symbol = v3n_i) = Vector[column]([[v3n_i[1]], [v3n_i[2]], [v3n_i[3]]], ["x", "y", "z"])NULL

nn := `&x`(v2n-v1n, v3n-v1n)

v4n := v1n+nn/norm(nn, 2)^.5``

``

 

Define Transformation

 

V := LinearAlgebra:-Transpose(Matrix([v2-v1, v3-v1, v4-v1]))

Dimension(V) = 3, 3 

Vn := LinearAlgebra:-Transpose(Matrix([v2n-v1n, v3n-v1n, v4n-v1n]))

Dimension(Vn) = 3, 3NULL

Note we have Vn = T*V and if the current triangle is not degenerate, then T = Vn/V. As we can pre-compute 1/V we define a new matrix for it:

Vinv := Matrix(3, 3, symbol = Vinv_ij) =

Matrix(%id = 18446746713267339006)

(1.2.1)

T := MatrixMatrixMultiply(Vn, Vinv)

Dimension(T) = 3, 3``

``

``

Define Energy

 

E := Trace(MatrixMatrixMultiply(T, LinearAlgebra:-Transpose(T)))``

``

``

Gradient and Hessian

 

gradE := Gradient(E, [v1n[1], v1n[2], v1n[3], v2n[1], v2n[2], v2n[3], v3n[1], v3n[2], v3n[3]])

Dimension(gradE) = 9NULL

CodeGeneration[C](gradE, defaulttype = numeric, optimize = tryhard, functionprecision = double, precision = double, deducetypes = false, resultname = 'gradE')t1 = v2n_i[0] - v1n_i[0];
t2 = v2n_i[1] - v1n_i[1];
t3 = v2n_i[2] - v1n_i[2];
t4 = t1 * Vinv_ij[0][0] + t2 * Vinv_ij[1][0] + t3 * Vinv_ij[2][0];
t5 = t1 * Vinv_ij[0][1] + t2 * Vinv_ij[1][1] + t3 * Vinv_ij[2][1];
t6 = t1 * Vinv_ij[0][2] + t2 * Vinv_ij[1][2] + t3 * Vinv_ij[2][2];
t7 = v3n_i[0] - v1n_i[0];
t8 = v3n_i[1] - v1n_i[1];
t9 = v3n_i[2] - v1n_i[2];
t10 = t7 * Vinv_ij[0][0] + t8 * Vinv_ij[1][0] + t9 * Vinv_ij[2][0];
t11 = t7 * Vinv_ij[0][1] + t8 * Vinv_ij[1][1] + t9 * Vinv_ij[2][1];
t12 = t7 * Vinv_ij[0][2] + t8 * Vinv_ij[1][2] + t9 * Vinv_ij[2][2];
t13 = t2 * t9 - t3 * t8;
t14 = fabs(t13);
t15 = t1 * t9 - t3 * t7;
t16 = fabs(t15);
t17 = t1 * t8 - t2 * t7;
t18 = fabs(t17);
t19 = pow(t14, 0.2e1) + pow(t16, 0.2e1) + pow(t18, 0.2e1);
t20 = pow(t19, -0.5e1 / 0.4e1);
t19 = t19 * t20;
t21 = Vinv_ij[0][0] * t13;
t22 = Vinv_ij[1][0] * t15;
t23 = Vinv_ij[2][0] * t17;
t24 = (t23 + t21 - t22) * t19;
t25 = -v2n_i[2] + v3n_i[2];
t26 = fabs(t15) / t15;
t27 = -v2n_i[1] + v3n_i[1];
t28 = fabs(t17) / t17;
t21 = t23 + t21 - t22;
t22 = (t16 * t25 * t26 + t18 * t27 * t28) * t20;
t23 = 0.1e1 / 0.2e1;
t29 = Vinv_ij[0][1] * t13;
t30 = Vinv_ij[1][1] * t15;
t31 = Vinv_ij[2][1] * t17;
t32 = (t31 + t29 - t30) * t19;
t29 = t31 + t29 - t30;
t30 = Vinv_ij[0][2] * t13;
t15 = Vinv_ij[1][2] * t15;
t17 = Vinv_ij[2][2] * t17;
t31 = (t17 + t30 - t15) * t19;
t15 = t17 + t30 - t15;
t17 = t6 + t12;
t30 = t5 + t11;
t33 = t4 + t10;
t13 = fabs(t13) / t13;
t34 = -v2n_i[0] + v3n_i[0];
t35 = (t14 * t25 * t13 - t18 * t34 * t28) * t20;
t35 = t17 * Vinv_ij[1][2] - t24 * (t23 * t35 * t21 - t19 * (t25 * Vinv_ij[0][0] - t34 * Vinv_ij[2][0])) + t30 * Vinv_ij[1][1] - t31 * (t23 * t35 * t15 - t19 * (t25 * Vinv_ij[0][2] - t34 * Vinv_ij[2][2])) - t32 * (t23 * t35 * t29 - t19 * (t25 * Vinv_ij[0][1] - t34 * Vinv_ij[2][1])) + t33 * Vinv_ij[1][0];
t36 = (t14 * t27 * t13 + t16 * t34 * t26) * t20;
t34 = Vinv_ij[2][2] * t17 - t24 * (-t23 * t36 * t21 + t19 * (t27 * Vinv_ij[0][0] - t34 * Vinv_ij[1][0])) + t30 * Vinv_ij[2][1] - t31 * (-t23 * t36 * t15 + t19 * (t27 * Vinv_ij[0][2] - t34 * Vinv_ij[1][2])) - t32 * (-t23 * t36 * t29 + t19 * (t27 * Vinv_ij[0][1] - t34 * Vinv_ij[1][1])) + t33 * Vinv_ij[2][0];
t36 = (t16 * t9 * t26 + t18 * t8 * t28) * t20;
t36 = t24 * (-t23 * t36 * t21 - t19 * (-t8 * Vinv_ij[2][0] + t9 * Vinv_ij[1][0])) + t31 * (-t23 * t36 * t15 - t19 * (-t8 * Vinv_ij[2][2] + t9 * Vinv_ij[1][2])) + t32 * (-t23 * t36 * t29 - t19 * (-t8 * Vinv_ij[2][1] + t9 * Vinv_ij[1][1])) + t4 * Vinv_ij[0][0] + t5 * Vinv_ij[0][1] + t6 * Vinv_ij[0][2];
t37 = (t14 * t9 * t13 - t18 * t7 * t28) * t20;
t9 = t24 * (-t23 * t37 * t21 + t19 * (-t7 * Vinv_ij[2][0] + t9 * Vinv_ij[0][0])) + t31 * (-t15 * t23 * t37 + t19 * (-t7 * Vinv_ij[2][2] + t9 * Vinv_ij[0][2])) + t32 * (-t23 * t29 * t37 + t19 * (-t7 * Vinv_ij[2][1] + t9 * Vinv_ij[0][1])) + t4 * Vinv_ij[1][0] + t5 * Vinv_ij[1][1] + t6 * Vinv_ij[1][2];
t37 = (t14 * t8 * t13 + t16 * t7 * t26) * t20;
t4 = t24 * (t23 * t37 * t21 - t19 * (-t7 * Vinv_ij[1][0] + t8 * Vinv_ij[0][0])) + t31 * (t15 * t23 * t37 - t19 * (-t7 * Vinv_ij[1][2] + t8 * Vinv_ij[0][2])) + t32 * (t23 * t29 * t37 - t19 * (-t7 * Vinv_ij[1][1] + t8 * Vinv_ij[0][1])) + t4 * Vinv_ij[2][0] + t5 * Vinv_ij[2][1] + t6 * Vinv_ij[2][2];
t5 = (t16 * t3 * t26 + t18 * t2 * t28) * t20;
t5 = t10 * Vinv_ij[0][0] + t11 * Vinv_ij[0][1] + t12 * Vinv_ij[0][2] + t24 * (t21 * t23 * t5 + t19 * (-t2 * Vinv_ij[2][0] + t3 * Vinv_ij[1][0])) + t31 * (t15 * t23 * t5 + t19 * (-t2 * Vinv_ij[2][2] + t3 * Vinv_ij[1][2])) + t32 * (t23 * t29 * t5 + t19 * (-t2 * Vinv_ij[2][1] + t3 * Vinv_ij[1][1]));
t6 = (-t18 * t1 * t28 + t14 * t3 * t13) * t20;
t3 = t10 * Vinv_ij[1][0] + t11 * Vinv_ij[1][1] + t12 * Vinv_ij[1][2] + t24 * (t21 * t23 * t6 - t19 * (-t1 * Vinv_ij[2][0] + t3 * Vinv_ij[0][0])) + t31 * (t15 * t23 * t6 - t19 * (-t1 * Vinv_ij[2][2] + t3 * Vinv_ij[0][2])) + t32 * (t23 * t29 * t6 - t19 * (-t1 * Vinv_ij[2][1] + t3 * Vinv_ij[0][1]));
t6 = (t16 * t1 * t26 + t14 * t2 * t13) * t20;
t1 = t10 * Vinv_ij[2][0] + t11 * Vinv_ij[2][1] + t12 * Vinv_ij[2][2] + t24 * (-t21 * t23 * t6 + t19 * (-t1 * Vinv_ij[1][0] + t2 * Vinv_ij[0][0])) + t31 * (-t15 * t23 * t6 + t19 * (-t1 * Vinv_ij[1][2] + t2 * Vinv_ij[0][2])) + t32 * (-t23 * t29 * t6 + t19 * (-t1 * Vinv_ij[1][1] + t2 * Vinv_ij[0][1]));
t2 = 0.2e1;
gradE[0] = -t2 * (-t24 * (t23 * t22 * t21 + t19 * (t25 * Vinv_ij[1][0] - t27 * Vinv_ij[2][0])) + t33 * Vinv_ij[0][0] + t30 * Vinv_ij[0][1] + t17 * Vinv_ij[0][2] - t32 * (t23 * t22 * t29 + t19 * (t25 * Vinv_ij[1][1] - t27 * Vinv_ij[2][1])) - t31 * (t23 * t22 * t15 + t19 * (t25 * Vinv_ij[1][2] - t27 * Vinv_ij[2][2])));
gradE[1] = -t2 * t35;
gradE[2] = -t2 * t34;
gradE[3] = t2 * t36;
gradE[4] = t2 * t9;
gradE[5] = t2 * t4;
gradE[6] = t2 * t5;
gradE[7] = t2 * t3;
gradE[8] = t2 * t1;

``

``

``

``

``

Hessian

 

``

hessE := Hessian(E, [v1n[1], v1n[2], v1n[3], v2n[1], v2n[2], v2n[3], v3n[1], v3n[2], v3n[3]])

Dimension(hessE)

9, 9

(1.5.1)

 

CodeGeneration[C](hessE, optimize = tryhard, deducetypes = false, resultname = 'hessE')

Error, (in Print) improper op or subscript selector

 

``

````

``

``

``

``


 

Download membrane_energy.mw

 

 

 

Dear Experts,

Please how do I carry out the differentiation of 

y[1](t)*y[2](t)*(y[1](t)+y[2](t))^3

with respect to y[1] using maple? I know how to use maple if the derivative is with respect to t.
Thank you in anticipation

Dear all

I would like to solve a linear system A X=b whee A is a matrix n times n

If A is a tri-diagonal matrix, how can we write simple code to make A upper-triangular and then we solve the system using backward substitution

many thanks

 

Here is a strange one...


1> /Library/Frameworks/Maple.framework/Versions/2019/bin/maple ; exit;
    |\^/|     Maple 2019 (APPLE UNIVERSAL OSX)
._|\|   |/|_. Copyright (c) Maplesoft, a division of Waterloo Maple Inc. 2019
 \  MAPLE  /  All rights reserved. Maple is a trademark of
 <____ ____>  Waterloo Maple Inc.
      |       Type ? for help.
> version():                                                                   
 User Interface: 1435526
         Kernel: 1435526
        Library: 1435526
> I0:=(x - 11)^(n)*x/(x^(n + 1));                                              
                                             n
                                     (x - 11)  x
                               I0 := -----------
                                       (n + 1)
                                      x

> I1:=(x - 11)^(n)/(x^(n));                                                    
                                              n
                                      (x - 11)
                                I1 := ---------
                                          n
                                         x

> is(I1=I0);                                                                   
memory used=2.5MB, alloc=40.3MB, time=0.14
                                     true

> Limit(I0,x=infinity)=limit(I0,x=infinity) assuming n::posint;                
                                            n
                                    (x - 11)  x
                          lim       ----------- = infinity
                     x -> infinity    (n + 1)
                                     x

> Limit(I1,x=infinity)=limit(I1,x=infinity) assuming n::posint;                
                                                n
                                        (x - 11)
                              lim       --------- = 1
                         x -> infinity      n
                                           x

This was in Maple 2019.2 ... but I had Maple 18 (from 2014) running here, and it does the same thing.

 

How strange is this: replace 11 by 10 (or less) and the error goes away.

 

Recently found out about Steiner ellipsoids. This is an ellipsoid inscribed in a tetrahedron, and an ellipsoid described near a tetrahedron. One ellipsoid touches the faces of the tetrahedron in centroids, the other ellipsoid touches the planes in vertices of the tetrahedron, and these planes are parallel to the faces.
steiner_in_ellipsoid.mw
steiner_out_ellipsoid.mw

There is a desire to find out if 4 vertices determine the tetrahedron or not. And it seems Maple answer this question:

restart: with(geom3d):
point(A, 0, 0, 0), point(B, 1, 0, 0), point(C, 0, 0, 1), point(F, 0, 1, 0):
gtetrahedron(T1, [A, B, C, F]):
i := nops(op(0, detail(T1))); 
if i = 1 then print("Ok gtetrahedron") else print("No gtetrahedron") end if:

 I want to stop further execution of the program if the tetrahedron is not determine, for example, when point
B = [0,0,0], but I don’t know how to do it.

 

I have a nested list like this,

Spectrums:=[ [graph1,eigenvalue of the graph1] , [graph2,eigenvalue of the graph2], ... ,[graphN,eigenvalue of the graphN] ]

What is the easiest / efficient way to group the list with respect to second value (eigenvalue)?

rfin := proc(m::integer) 
local c, i, flg := 0;
for i from 0 to m do
	local b := i;
	do 
		c := b mod 3;
		if (c <> 2) then next else flg := 1; 
		end if;
		b := 1/3*b - 1/3*c;
	until b = 0;
	if evalb(flg = 0) then print(i); 
	end if; 
end do;
end proc;

Hello everyone. I've written a procedure that outputs all numbers <= a given user I/P whose ternary representation has no 2.

However, I get an "Error, unterminated loop" message. Can someone please out the mistake(s)?

I am trying to simplify an expression, and leave W in terms of other variables. But unfortunately I can't delete the RootOf, and I can't see the expressions. Could you please help me.

 

 

Dear all

I have an optimization problem. I would like to add a condition to obtain only a positive integer as the solution to the problem 

 

 

Positive_integer.mw

 

thanks

Update:This bug ONLY occurs when the file title containing Chinese Characters.

 

The .mw files have already been associated with Maple 2020, but when clicking on any of them, Maple 2020 won't launch as expected and nothing actually will happen.
I have tried to reinstall Maple 2020, but the problem just keep existing.

The Windows version where the bug occurs is Windows 10 version 1909.

 

Hello everyone I need your help  please, I found a problem with solving an equation to explain this in detail ,here is  the problem how it is posed :

first of all we have N(q)=(exp(q)/sqrt(q))*sqrt(3/2)*D(3*q/2) .     (1)

with: D(3*q/2)=exp(-3*q/2)*integral(t^2)*dt with t varie from 0 to sqrt(3*q/2) this integral is known as Dawson's name     (2)

then we have q=(24/(n-3))*(x*k*m)/t with : t=0.6,n=6,k=1.3, so q=18.66666667*x*m    (3)

finaly we have m = 1/2*[(exp(q)/(q*N(q)))-1-1/q]     (4)

the quetion : is we must  find the expression of m  (4)  as a function of x only .

thank you evryone .

Hi everyone,

In the RandomTools package, the Generate(integer(range = A..B)) function generates a random integer in the range A..B. All integers in that range have the same probability to be generated, that is, 1/nops([seq(A..B)]). However, I would like to specify the probabilities of each integer. How to do so?

Example: range = 1..5. Instead of P(X=j)=1/5 with j =1,2,3,4,5, let's say the probabilities should be as follows:

P(X=1) = 0.2, P(X=2) = 0.5, P(X=3) = P(X=4) = P(X=5) = 0.1

How to generate a random integer between 1 and 5 with these probabilities?

Thank you in advance.

First 569 570 571 572 573 574 575 Last Page 571 of 2425