MaplePrimes Questions

Is there a way to see the Maple implementation of Runge Kutta 4th order method in dsolve?

By searching I found I can print the implementation of a procedure as follows

interface(verboseproc = 2)

print(dsolve)

But I'd like specifically to see the code for the method RK45.

It is easy to simplify the following expression (to 4), but maple's ceil function does not seem to be interested in simplifying it.

where n is greater than or equal to 4. 

simplify(ceil((3*n-8)/(n-3))) assuming n>=4, n::positive # As-is output

We have to rewrite "(3*n-8)/(n-3)" in this form "3 + 1/(n - 3)" to recognize.

simplify(ceil(3 + 1/(n - 3))) assuming  n>=4, n::positive

4

  • My first question is: How to transform (3*n-8)/(n-3) into 3 + 1/(n - 3) by maple?
  • My second question: Can we see the steps of execution of the simplification involving  ceil)?

I am trying to generate c code for a LinearAlgebra test problem using Maple:

But the output cannot be used due to the warning:

Warning, the function names {KroneckerProduct} are not recognized in the target language

The proposed code looks like:

How to resolve of this ODE System Error, the proble is "Error, (in dsolve/numeric/process_input) input system must be an ODE system, got independent variables {t, [S, E, In, R]}

Download TKO.mw

I need a combobox with two columns but I don't think it is possible.  I want to display a list of acids with their names and dissociation constants.

Don't know if this is a bug or just another proof of my incompetence, but I am struggling in storing values between sessions using DataTable components.

The problem seems to me to be related to nested tables, somehow.

I've made a little example showing the problem.

Quickly explained, you should do 2 runs to see the problem. The first run creates a matrix and a table, and stores the values in a DataTable cell. You shouldn't see any problems there.

Save the document and close it.

Then open the file once again, but just run the 2 commands in chapter 4. You should then see an error message.

My goal is to be able to save a nested variables with its values in a Datatable between sessions. The main variable and many of them below are tables, the last in the branch often string values or numbers with units.

StoreBetweenSessions.mw

How should I change w1 to w2 only in exponential? For example, let

x := omega1*exp(omega1*t1*I) + omega1/exp(omega1*t1*I)

expect result:

x := omega1*exp(omega2*t1*I) + omega1/exp(omega2*t1*I)

I want to make proc that returns expression sequence of two numbers, say. A,B

This will be the normal return, but if the proc encounters an error, it should return FAIL. But this is not possible, because if I type A,B:=foo(0) and foo() happenes to return FAIL then Maple will complain

Error, mismatched multiple assignment of 2 variables on the left side and 1 value on the right side

The three workarounds I see are these

Method 1

I could wrap foo() with try/catch and have foo throw an exception when it encouters an error instead of returning FAIL, but I do not like this. This will look like

restart;
interface(warnlevel=4);
kernelopts('assertlevel'=2):
foo:=proc(n::integer)::integer,integer;
  if n=0 then
     error ("encountered error");
  else
     return 1,2;
  fi;
end proc;

And now the caller will do

try
   A,B:=foo(0);
catch:
   print("encountered error");
end try;

method 2

Another option is to have foo() return ONE value back. In the case of an error it will be FAIL, and in the case of normal behavior, it will be a LIST of the two items, which then I have to extract.  Like this

interface(warnlevel=4);
kernelopts('assertlevel'=2):
foo:=proc(n::integer)::Or(list(integer),identical(FAIL));
      if n=0 then
         return FAIL;
      else
         return [1,2];
      fi;
end proc;

And now the caller will do this

L:=foo(1);
if L<>FAIL then
   A:=L[1];
   B:=L[2];
else
   print("failed call");
fi;

But this is not as easy as just calling foo() as   A,B:=foo() but I can't do this due to the mismatch problem.

Another method, commonly used in C programming is to have the function return status an additional output and this will indicate if the call was success or not. so the caller has to remember to always check for this before using the returned values. These are handled by errno, perror(), strerror(). But for now, lets make the function return the status.

So caller will first check if status is success first and if so, then it will read the actual returned values that follow it. Like this (status is true/false)

method 3

interface(warnlevel=4);
kernelopts('assertlevel'=2):
foo:=proc(n::integer)::truefalse,integer,integer;
  if n=0 then
     return false,0,0;
  else
     return true,1,2;
  fi;
end proc;

And the caller will do

status,A,B:=foo(1);
if status then
   print("call was success, A and B are ",A,B);
else
   print("call failed");
fi;

So the return values will always have status as first argument that the caller has to check before reading the rest of returned values.

From the above three options which you think is best?

Anyone can suggest alternatives to the above methods?

FourTrans.mwI am wondering if I can calculate this Fourier Transfrom analytically using Maple:

Good day to all, i want to plot the matrix but here is a problem...

with(plots);
with(LinearAlgebra);

x(t) := `<|>`(`<,>`(.9582+1.9874*t-2.059*t^2+2.6184*t^3-3.7508*t^4, 1.11935+1.4898*t-.6319*t^2+1.037*t^3-1.4695*t^4))

matrixplot(x(t), t = 0 .. 4)

Error, (in plots/matrixplot) cannot convert first argument to a floating-point matrix

please help me...... how to solve this?

tot := 1:         
for z in 1, x, y, q^2, 3 do    
    tot += z;  
end do:  
tot;

When I run the code above, Maple gives me "Error, unterminated loop".

However, if I change the code to 

tot := 1;
for z in 1, x, y, q^2, 3 do
    tot := tot + z;
end do:
tot;

Maple computes the result correctly.

I don't see how the loop is unterminated. Am I not allowed to use operator assignments in loops?

I have been using Maple Calculator on my phone and found that the "Steps" to solutions option was useful, particularly for integration. However, I spend more time on my computer than phone and thought that Maple Learn would be even better. When I tried the free version of Maple Learn the "Steps" button never appeared. I thought this might be because it is only available with a subscription, so I have subscribed for one month to evaluate. However, after doing that the "Steps" button still did not appear. After a bit of digging, I found the Steps documentation and found you must open specific documents from the Maple Gallery for different problems to get the Steps button which seems a bit odd when the Maple Calculator does this automatically. Worse still there does not seem to be an option for integration!

Although I can see a lot of benefits with Maple Learn this seems to be a backward step (pardon the pun). Also, even though I have subscribed to Maple Learn, I still do not appear to have Premium on my phone in the same account. Again, a little disappointing.

Have I misunderstood something or is this the way it is?

Will

As a newbie I am still trying to learn Maple. I was wondering whether it is possible to import this txt file 2011068_2_ex.txt which contains results of different measurements separated by a header. I would like to import the data for each measurement without the header and to extract some data from the header. Is this possible in Maple and what should be the best method for doing so? What I would like to obtain at the end is Extracted_from_the_header.txt and raw data for the 4 measurements.

Thank you in advance for all help.

If I want to get an irreducible polynomial with root sqrt(5) and minimum degree, I can use:

with(PolynomialTools):
MinimalPolynomial(sqrt(5), x)

But what if I want this irreducible polynomial of the minimum degree to have roots in both sqrt(2), sqrt(3), and sqrt(5)? How do I get this polynomial?

ps: The coefficients are all integers

please, help me..this is my model

First 135 136 137 138 139 140 141 Last Page 137 of 2308