blink23

5 Reputation

One Badge

9 years, 305 days

MaplePrimes Activity


These are replies submitted by blink23

@Joe Riel 

Joe, I think you are a genius. The export solution is doing the job very well.

But there is also a downside:

If you define q:=2*i_+3*j_ and you want to have (for example) the coefficient of i neither coeff(q,i) nor coeff(q,i_) works. I don't want to annoy because you helped that much and things appear a lot clearer to me. So maybe in future I will get back to this one!

Thank you!!!!

@Joe Riel 

Thank you for all the hints Joe.

Now I'm getting curious about some things. I think the homewrok is fine with the "ModuleLoad" proc. Anyway i tried to declare i, j, k, epsilon as locals in the module. Everything works great and I can still use i,j,k,.. in other scopes (as your seq for example). When I call Pretty(q) the i,j,k,epsilon is displayed even though I set i to a specific value. What I can't do is define a quaternion as: 2*i+3*j+...., because then the value of i is substituted. This messes me up a little bit :) But I think the reason is for the different namespaces the i,j,k,epsilon is in. Am I right?

@Preben Alsholm

That's perfect for my purpose. Thank you for the hint!

@Mac Dude

Now I get it! It took me some time to understand the namespace thing. If I'm saving the module "myQuaternions.mla" in the standard library directory, the solution of Joe Riel is not that nice. The symboly "i,j,k,epsilon" are still protected, but they are in the namespace of myQuaternions, resulting in being displayed as "myQuaternions:-i"... That solution is anyway not so nice.

So the new question: If I define "i,j,k,epsilon" to be global, they are not protected any more. So is there an efficient way to protect them automatically by loading the package myQuaternions?

@Mac Dude

Thank you for the answer. The solution of Joe Riel worked great for me. Adding i,j,... as exports protects them as wished. I simply want them to be protected to avoid overwriting these symbols.

 

Page 1 of 1