MaplePrimes Questions

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

To create a parametric plot, it seems that all units from an expression have to be removed. Convert, unit_free only removes the outermost unit from an expression. Are there any other commands that could be used?

The attached document describes the problem and solution attempts.

 

Download Convert_unit_free_attempt.mw

Rectangle_within_semicircle.mw

Hi..What I want should be self explanetary. Trying to Explore 2 plots on the one graph.

This is another one of those problems that shows up only when I put all my modules in a lib and run the program, and unable to make a MWE in the worksheet.

Here is description of the problem. There is a module which is an object, which has no method. Just variables. 

export SUM_type:=module()
   option object;
      
   export starting_index::integer;
   export body;
   export power_on_x;
   export actual_sum;   
end module;

some where inside the program, a list is created of such objects. This problem only shows up when there is ONE object in the list. Where there is 2 or more objects in the list, no problem. The problem shows up here

for tmp in op(THE_SUMS) do    #BUG IN MAPLE  
        new_ode := new_ode + tmp:-actual_sum;
 od; 

The above code is from inside a proc in a module. The variable THE_SUMS is the list and tmp is just a local variable.

In the debugger, once I step in the loop, it generates an exception

The strange thing, this only happens when there is ONE object in the list and not more. Here are screen shot from the debugger window

To avoid this, I changed the loop to the following, and not it works with one or more entries in the list

   for N from 1 to nops(THE_SUMS) do
       tmp := THE_SUMS[N];
       new_ode := new_ode + tmp:-actual_sum;
   od;

And this work. I spend a lot of time trying to make a MWE, but it works ok in worksheet. It looks like a scoping issue. I do not use ModuleIterator, and do not need it. When I added one to the object above just to see what happens, I saw the ModuleItrator being called. I have no idea why Maple wants to call it when there is one object in the list.

Here is one attempt on a MWE. but this gives no error. 

SUM_type:=module()
   option object;
   
   export starting_index::integer;
end module;
o:=Object(SUM_type):
o:-starting_index:=1;
L:=[o]:
for item in L do  #OK here since in global name space?
    print(item);
od;

I am just repoting this in case someone have seen it before. I have a workaround it as I showed, which is to avoid using `for temp in list` when the list has objects in it.

Maple 2021.1 on windows 10

Dear Maple users

How do I turn a text into a Matrix of letters in the most convenient and effective way in Maple? Let's say the text contains N letters and the first n of these should be placed in the first row, the next n letters in the second row and so on. In my first question the text is one continous string of only letters a-z with no spaces or numbers, etc. 

My second question would be how I can do the same as above, if the text contains spaces, numbers and other special symbols, which should be ignored. 

The subject is Cryptography. I hope some can help.

Erik

I want to solve the equation x^(1/x) =1.2
solve(x^(1/x)=1.2)

The output is 1.257734541376526421
How do i get the other solution, numerically.

Is it possible to restrict or stipulate the domain to look for roots over a specific interval, some rootfinding command over the real numbers.
I also tried solve(x^(1/x)=1.2,AllSolutions,explicit)
Wolfram immediately gives me the second solution. https://snipboard.io/Nqt74K.jpg https://snipboard.io/Nqt74K.jpg

First 243 244 245 246 247 248 249 Last Page 245 of 2308