MaplePrimes Questions

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.

Given  3000 linear equations in 3000 unknowns, with coefficients in a field of rationals with one algebraic number extension, which Maple solver would be fastest in solving the system?

From
with(numtheory):
msolve(x^2=-1,5);                                I get
                        {x = 2}, {x = 3}
But I need the integers 2 and 3. Who can help me?

Good day!

I would welcome any help to explain how to plot a simple function, z, of two variables, (x, y) so that I can show the relationships between variables.

Basically, I need to plot a family of z-curves for varying x and y values and also would like to understand how to display the z-y and z-x plots. 

Thanks for reading!

MaplePrimes_Nov_29.mw

First 17 18 19 20 21 22 23 Last Page 19 of 2086