Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

I want to simplify the following expression to 2a-2bk+k(n+6). But the following command is invalid.

algsubs(n2+n1=n+6,a+(n1-b)*k+a+(n2-b)*k);

 

However, the above expression can be simplified when k is fixed to a number, such as k=2.

algsubs(n2+n1=n+6,a+(n1-b)*2+a+(n2-b)*2);

I wonder what went wrong.

It seems to be recognized only if n1+ n2 is combined.

algsubs(n1+n2=n+6,simplify(a+(n1-b)*k+a+(n2-b)*k))

We’ve been busy! We have just released the 2021.2 updates for Maple, Maple Flow, and MapleSim. Here’s a quick overview. These updates are freely available to all customers who have the 2021 version of these products.

Maple

The Maple update includes a variety of corrections and improvements to the math engine and interface. It is available through Tools>Check for Updates in Maple, and is also available from the Maple 2021 download page, where you can also find more details.

In particular, this update includes fixes to the bug in the combine command when working with double summations, and the problems when performing context menu operations on values with units while in Document mode, both of which were reported on MaplePrimes. As always, we appreciate the feedback!

Maple Flow

The Maple Flow 2021.2 update offers a richer range of formatting features for creating professional-looking engineering documents, which have been requested by customers. Highlights include sections, controlling the display of commands, annotating images, and disabling automatic evaluation while making a series of changes.  This update is available from the Maple Flow 2021.2 download page, which also contains more details.

MapleSim

Lots of good stuff here that makes it easier to build and analyze models, including productivity features that speed up the creation of models that use hydraulics, support for the latest CAD file formats in the MapleSim CAD toolbox, the ability to model drift conditions with the MapleSim Tire Library, tools for simulating 3-D winding effects with the MapleSim Ropes and Pulleys Library, and a new MapleSim Web Handling Library add-on (which, I am sad to say, has nothing to do with Spiderman). See What’s New in MapleSim for details, and the MapleSim 2021.2 download page for instruction on how to obtain your update.

Error occurred running sample test.java (at new EngineCallBackDefault()):

# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffd66e7345a, pid=1740, tid=7716
#
# JRE version: Java(TM) SE Runtime Environment (11.0.1+13) (build 11.0.1+13-LTS)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (11.0.1+13-LTS, mixed mode, tiered, compressed oops, g1 gc, windows-amd64)
# Problematic frame:
# C  [maplec.dll+0x345a]
#
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.

Hello 

Imagine you have an irregular polygon as follows:

restart; with(plottools):with(plots):

display(polygon([[0,0],[200,0],[200,300],[250,400],[500,300],[500,500],[0,500]]),color=yellow,linestyle=solid,thickness=2);

with vertices that can be easily defined, and that you have an arbitrary point P(x,y) with coordinates of (x) and (y). I want Maple to check whether the point P(x,y) is inside or outside the polygon. In Matlab, the command (inpolygon) can be used for such a task. Is there a similar readily available command in Maple. 

Thank you very much for your help and support. 

 I can't seem to figure out how to use arctan on a complex number in Maple.  I expect arctan(a+jb) assuming a and b are real to return atan(b/a).  Instead, returns arctan(a+Ib).  How do I do this?

restart

````

assum := R1::real, C1::real, omega::real, vab::real

R1::real, C1::real, omega::real, vab::real

(1)

Pab := expand(rationalize(vab/(R1-I/(omega*C1))))``

vab*omega^2*C1^2*R1/(C1^2*R1^2*omega^2+1)+I*vab*omega*C1/(C1^2*R1^2*omega^2+1)

(2)

Pabmag := `assuming`([abs(Pab)], [assum])

(vab^2*omega^4*C1^4*R1^2/(C1^2*R1^2*omega^2+1)^2+vab^2*omega^2*C1^2/(C1^2*R1^2*omega^2+1)^2)^(1/2)

(3)

Pabang := `assuming`([arctan(Pab)], [assum])

arctan(vab*omega^2*C1^2*R1/(C1^2*R1^2*omega^2+1)+I*vab*omega*C1/(C1^2*R1^2*omega^2+1))

(4)

``

test out how to use arctan....

`assuming`([arctan(a+I*b)], [a::real, b::real])

arctan(a+I*b)

(5)

``

Download complex_power_RC.mw

hello,

Inverse laplace (invlaplace) isn't working.

g(s) is an exponential function expressed by the linear equation of s.

d(s) is an exponential function expressed by the  quadratic equation of s.

g(s)'s invplace is worked well, but d(s) isn't working. What happen?

restart;
with(inttrans);

g(s) := s -> exp(-3*s):


gg(t) := t -> invlaplace(g(s), s, t):


gg(t);
                          Dirac(t - 3)


d(s) := s -> exp(s^2):


k(t) := t -> invlaplace(d(s), s, t):


k(t);
                           /      uminus01/   / 2\      \  
     Typesetting:-mcomplete\ℒ        \exp\s /, s, t/, 

                         /[          /   / 2\      \]\\
       Typesetting:-_Hold\[invlaplace\exp\s /, s, t/]//


 

Dear all

I compute the solution of first order nonlinear ode, supplied to initial condition.

The code is written, the exact solution is derived.

 plot the solution in a small interval like (0,1/5) I see that there is no difference between exact and semi-analytical soluton.

But, If I plot the solution in other interval like (0,1) or (0,2), It is noticed that the semi-analytical solution is different to the exact solution. 
Thansk you in advance for your help 

test3.mw

Hi

I am trying to follow a textbook example concerning the calculations of probability based on continous joint distributions. I cannot calculate the same result using Maple, specifically the double integral.

In a effort to determine what I need help with I have presented the example and what I know, in order to potentially rule out potential misconceptions with regard to the theory itself and maybe not a lack of Maple skills..

The example is a follows;

 

My thoughts / attempt:

So we are dealing with independent variables which are exponetially distributed. We need to find the prob. that P(X<Y), so we need to find the joint density of the distributions. We know the density of an exponential distributed variable, and since they are independent, the product of their densities is the desired joint density function f(x,y) we need in order to evaluate the probabilty;

f(x, y) = lambda*exp(-lambda*x)*mu*exp(-mu*x)

My book states that the probability of a set B, w.r.t to two continuous distributions is

so with regard to my specific case, B can be substituted with X<Y, and as such should also be applied appropriately to the limits of the integrals.

We know that both distributions have the same exponential distribution (in) [0,+inf], and that X<Y is to be determined, thus we can conlude that

{(x,y) : 0 < x < y < +inf}

Thus the probability is given by (as presented in the book):

Can Maple directly solve this integral from such an expression?

The book chooses to split up the double integral with respect to the limits of the variables(distributions?);

x is of course the lowerbound for the dy integral as y is specfied to be larger than x..

So ultimately my problem is that I cannot replicate the last integral expression ,I end up with;

-lambda*exp(-lambda*x - mu*y) + lambda*exp(-lambda*x - mu*x)

So an additional term.. I am just ignorant, and should I ultimately know that I have to disregard the contribution term containg the y variable seeing that we have to inetgrate w.r.t to the last dx integral?doubleintegralprobability.mw

``

``

int(lambda*mu*exp(-lambda*x-mu*y), y = x .. infinity)

limit(-lambda*exp(-lambda*x-mu*y)+lambda*exp(-lambda*x-mu*x), y = infinity)

(1)

``

``

``

``

``

``

NULL

`assuming`([simplify(combine(int(lambda*mu*exp(-lambda*x-mu*y), y = x .. infinity)), size)], [x > 0, y >= x, y > 0])

limit(lambda*(-exp(-lambda*x-mu*y)+exp(-x*(lambda+mu))), y = infinity)

(2)

NULL

NULL

NULL

NULL

NULL

NULL

NULL

int(lambda*mu*exp(-lambda*x-mu*y), y = x .. infinity)

limit(-lambda*exp(-lambda*x-mu*y)+lambda*exp(-lambda*x-mu*x), y = infinity)

(3)

``

Download doubleintegralprobability.mw

Any thoughts would be greatly appreciated, thanks in advance.

Apparently a colon within a string causes some issues when generating a XMLElement.

Didn't find anything in Maple Help about that though.

with(XMLTools)

dummy := "NS-EN 1995-1-1, part 1-1, Section 6"

"NS-EN 1995-1-1, part 1-1, Section 6"

(1)

XMLElement(dummy)

_XML_Element(_XML_ElementType("NS-EN 1995-1-1, part 1-1, Section 6"), [], [])

(2)

dummy1 := "NS-EN 1995-1-1, part 1-1, Section 6: Ultimate"

"NS-EN 1995-1-1, part 1-1, Section 6: Ultimate"

(3)

XMLElement(dummy1)

Error, (in XMLTools:-XMLElement) element tag name `NS-EN 1995-1-1, part 1-1, Section 6: Ultimate' contains the namespace prefix `NS-EN 1995-1-1, part 1-1, Section 6', but there is no `xmlns' attribute

 

NULL

Download xmlns.mw

How does one view procedures not listed for export in modules?

Good day everyone,

I have problem-solving this system of equations using Iterative Projection Theorem. Anyone with a better explanations please.

The equation is as stated below. 

 

Solve this set of equations using the iterative projection theorem.

(x1 - 2)2 + (2x22 - 6)2 - 5 = 0

(x12 - 4)2 + (x2 - 10)2 - 39 = 0

Take the provisional values of  x1 and x2 as x01 = 5, x02 = 4, 

Thank you in anticipation

Its a while ago i did some effort in trying to get better in programming of procedures
If i look at the Maple  programming guide, then all questions has no provided answers: why is that ?

So the sieve of Eratosthenes procedure in Maple?  
First what is the formula for this sieve.

Write a procedure that implements the sieve of Eratosthenes: Count the number of integers (less than or equal to a given integer) that are prime.

Maple Object model is somewhat limited.  One of the main reasons to use OOP is to be able to extend base class, and override methods in base class by new methods if needed.

This is described in  https://en.wikipedia.org/wiki/Method_overriding

Method overriding, in object-oriented programming, is a language feature that allows a subclass or child class to provide a specific implementation of a method that is already provided by one of its superclasses or parent classes. It allows for a specific type of polymorphism (subtyping). The implementation in the subclass overrides (replaces) the implementation in the superclass by providing a method that has same name, same parameters or signature, and same return type as the method in the parent class.[1] The version of a method that is executed will be determined by the object that is used to invoke it. If an object of a parent class is used to invoke the method, then the version in the parent class will be executed, but if an object of the subclass is used to invoke the method, then the version in the child class will be executed.[2] Some languages allow a programmer to prevent a method from being overridden.

Maple does not allow the extending class to override variables or methods in the base class. Even if the type of the variable or the sigature of the proc is different as long as the name is the same.

This makes it hard to override base class implementation and to do type extension.

Here is a toy example

restart;

 animal:=module()
   option object;
   export data1;

   export move::static:=proc(_self,$)
      print("In Animal class. moving ....");
   end proc;  
end module;
 
#create class/module which extends the above
dog:=module()
   option object(animal);
   export move::static:=proc(_self,$)
      print("In dog class. moving ....");
   end proc;  
end module;

Error, (in dog) export `move` is declared more than onc

All computer languages that supports OOP that I know about supports overriding, The above web page lists some. 

Ada,  C#C++, DelphiEiffel, Java, Kotlin, Python, Ruby

A workaround, is if such name conflict occurs, is to come up with new name. So the above example becomes


dog:=module()
   option object(animal);
   export move_the_dog::static:=proc(_self,$)
      print("In dog class. moving ....");
   end proc;  
end module;

And now Maple does not complain. But the whole point of type extension is to override the base class implementation, and not add a new implementation while keeping the base class one there.

Is there a way to do this in Maple? if not in current version, are there plans to add this to future Maple versions?

I have two functions U1 and U2 which are both piecewise functions. I want to determine the function representing the summation or subtraction of these two functions, that is, U=U1-U2 or U=U1+U2.

alpha := 0.01;
                         alpha := 0.01
U1 := piecewise((1 - alpha)*lambda[1] - lambda[2] <= 0, 0, 0 < (1 - alpha)*lambda[1] - lambda[2], 5)
U2 := piecewise(-(1 + alpha)*lambda[1] + lambda[2] <= 0, 0, 0 < -(1 + alpha)*lambda[1] + lambda[2], 5)

Suppose we have U=U1-U2. I am wondering how to draw regions defined by function U and also how to label them.

1 2 3 4 5 6 7 Last Page 3 of 1864