Jean-Baptiste R

45 Reputation

3 Badges

3 years, 352 days

MaplePrimes Activity


These are questions asked by Jean-Baptiste R

Input:

 a := x^2;
 whattype(x);
 b := x[1]^2;
 whattype(x[1]);
 CodeGeneration[C](a);
 CodeGeneration[C](b);

Output:

Do you know why cg0 =/= x[0]*x[0]?

Greetings!

For factorization and computing times purposes, I'd like Maple to not perform this automatic conversion.

whattype(a*b) gives whattype(a*b)

while whattype(a*a) gives whattype(a*a)

Alternatively, a way to factorize 6*x^2+a*x-10 into (a+6*x)*x-10 could do the trick.

Here's a list of the functions I've already tried:

  • factor
  • collect (so coeff too)
  • combine/expand

Any ideas?

Thank you!

I would like to "run" or execute parts of my code that I put in a same section. Unfortunately, selecting "Execute" when right-clicking on a section does nothing...

Here's a very simple example, working as intended:

 

 

Now, if I try to use the exception indexing function:

 

 

We can notice that b[1] isn't using exception anymore (as if the fourth input overwrote the second one) and that b[1][2] isn't linked to the value "two". However, if I define the tables first, I get the expected result:

 

 

Why does the exception indexing function prevent me from getting an existing table entry in the second case?

Page 1 of 1