acer

32385 Reputation

29 Badges

19 years, 338 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@Ronan Yes, thanks for the interesting details. I've reread the prior responses now -- sorry about the Body2 attribution.

Please note that that the variant you cite (just above) from my Answer sheet attachment is quite inefficient (much more so than plottools:-rotate itself, which can turn lean float[8] rtable data into cumbersome listlists). I was really just trying to illustrate some other kinds of syntax would work for you (and in particular which allowed for Matrix `Rot` to be pushed in by name, say).

And with yet another way (somewhat of a cross bewteen my original and Rouben's).

equilibrium_alt2.mw

@Christopher2222There are more ways to rebind the name `changecoords` than just by loading the `plots` package. So your response is not wholly correct.

Using colon-dash before the name gets the global name, regardless. Wrap it in uneval quotes if you want something that guards against collision-with-a-local *and* assignment to the global, etc. 

Your last comment goes against the main thrust of your initial question.


 

restart;

msg:="Picturesque meant - he decided after careful observation of the scenery that inspired Twoflower to use the word - that the landscape was horribly precipitous. Quaint, when used to describe the occasional village through which they passed, meant fever-ridden and tumbledown. Twoflower was a tourist, the first ever seen on the Discworld. Tourist, Rincewind had decided, meant 'idiot'.";

"Picturesque meant - he decided after careful observation of the scenery that inspired Twoflower to use the word - that the landscape was horribly precipitous. Quaint, when used to describe the occasional village through which they passed, meant fever-ridden and tumbledown. Twoflower was a tourist, the first ever seen on the Discworld. Tourist, Rincewind had decided, meant 'idiot'."

Elg_encrypt:=proc(s::string, r::posint,
                  p::posint, a::posint, b::posint)
  local hkt, L;
  if not r <= p-1 then
     error "r must be strictly less than p";
  end if;
  hkt := `mod`(a &^ r, p);
  L := convert(msg, bytes);
  return hkt, map( u->`mod`(u*b&^r, p), L );
end proc:

header,ciphertext:=Elg_encrypt(msg,20000000000,14654455471,
                               457454,13954306945):

Error, (in Elg_encrypt) r must be strictly less than p

header,ciphertext:=Elg_encrypt(msg,532123,14654455471,
                               457454,13954306945):

header;

9681348997

ciphertext;

[12432485341, 2579085006, 13736574369, 4105371047, 9573017222, 7824534168, 10017411248, 13292180343, 2356887993, 9573017222, 10017411248, 13765667419, 9795214235, 10017411248, 2801282019, 608404939, 4105371047, 13765667419, 11572790339, 13765667419, 11765894302, 10017411248, 13765667419, 4549765073, 10017411248, 13736574369, 2579085006, 4549765073, 10017411248, 4549765073, 13765667419, 2801282019, 830601952, 4105371047, 10017411248, 7824534168, 13765667419, 13736574369, 2801282019, 7824534168, 10017411248, 830601952, 9573017222, 4327568060, 13765667419, 6076051114, 8268928194, 13292180343, 10017411248, 7824534168, 386207926, 2801282019, 4105371047, 2579085006, 6076051114, 608404939, 13765667419, 6076051114, 830601952, 13765667419, 4105371047, 11765894302, 10017411248, 13765667419, 13292180343, 13736574369, 10017411248, 608404939, 10017411248, 7824534168, 2134690980, 13765667419, 4105371047, 11765894302, 2801282019, 4105371047, 13765667419, 2579085006, 608404939, 13292180343, 11543697289, 2579085006, 7824534168, 10017411248, 4549765073, 13765667419, 4994159099, 5853854101, 6076051114, 830601952, 4327568060, 6076051114, 5853854101, 10017411248, 7824534168, 13765667419, 4105371047, 6076051114, 13765667419, 9573017222, 13292180343, 10017411248, 13765667419, 4105371047, 11765894302, 10017411248, 13765667419, 5853854101, 6076051114, 7824534168, 4549765073, 13765667419, 11572790339, 13765667419, 4105371047, 11765894302, 2801282019, 4105371047, 13765667419, 4105371047, 11765894302, 10017411248, 13765667419, 4327568060, 2801282019, 608404939, 4549765073, 13292180343, 13736574369, 2801282019, 11543697289, 10017411248, 13765667419, 5853854101, 2801282019, 13292180343, 13765667419, 11765894302, 6076051114, 7824534168, 7824534168, 2579085006, 8268928194, 4327568060, 2134690980, 13765667419, 11543697289, 7824534168, 10017411248, 13736574369, 2579085006, 11543697289, 2579085006, 4105371047, 6076051114, 9573017222, 13292180343, 2385981043, 13765667419, 3245676045, 9573017222, 2801282019, 2579085006, 608404939, 4105371047, 6105144164, 13765667419, 5853854101, 11765894302, 10017411248, 608404939, 13765667419, 9573017222, 13292180343, 10017411248, 4549765073, 13765667419, 4105371047, 6076051114, 13765667419, 4549765073, 10017411248, 13292180343, 13736574369, 7824534168, 2579085006, 8268928194, 10017411248, 13765667419, 4105371047, 11765894302, 10017411248, 13765667419, 6076051114, 13736574369, 13736574369, 2801282019, 13292180343, 2579085006, 6076051114, 608404939, 2801282019, 4327568060, 13765667419, 386207926, 2579085006, 4327568060, 4327568060, 2801282019, 6298248127, 10017411248, 13765667419, 4105371047, 11765894302, 7824534168, 6076051114, 9573017222, 6298248127, 11765894302, 13765667419, 5853854101, 11765894302, 2579085006, 13736574369, 11765894302, 13765667419, 4105371047, 11765894302, 10017411248, 2134690980, 13765667419, 11543697289, 2801282019, 13292180343, 13292180343, 10017411248, 4549765073, 6105144164, 13765667419, 9795214235, 10017411248, 2801282019, 608404939, 4105371047, 13765667419, 830601952, 10017411248, 386207926, 10017411248, 7824534168, 11572790339, 7824534168, 2579085006, 4549765073, 4549765073, 10017411248, 608404939, 13765667419, 2801282019, 608404939, 4549765073, 13765667419, 4105371047, 9573017222, 9795214235, 8268928194, 4327568060, 10017411248, 4549765073, 6076051114, 5853854101, 608404939, 2385981043, 13765667419, 4994159099, 5853854101, 6076051114, 830601952, 4327568060, 6076051114, 5853854101, 10017411248, 7824534168, 13765667419, 5853854101, 2801282019, 13292180343, 13765667419, 2801282019, 13765667419, 4105371047, 6076051114, 9573017222, 7824534168, 2579085006, 13292180343, 4105371047, 6105144164, 13765667419, 4105371047, 11765894302, 10017411248, 13765667419, 830601952, 2579085006, 7824534168, 13292180343, 4105371047, 13765667419, 10017411248, 386207926, 10017411248, 7824534168, 13765667419, 13292180343, 10017411248, 10017411248, 608404939, 13765667419, 6076051114, 608404939, 13765667419, 4105371047, 11765894302, 10017411248, 13765667419, 5438553125, 2579085006, 13292180343, 13736574369, 5853854101, 6076051114, 7824534168, 4327568060, 4549765073, 2385981043, 13765667419, 4994159099, 6076051114, 9573017222, 7824534168, 2579085006, 13292180343, 4105371047, 6105144164, 13765667419, 8713322220, 2579085006, 608404939, 13736574369, 10017411248, 5853854101, 2579085006, 608404939, 4549765073, 13765667419, 11765894302, 2801282019, 4549765073, 13765667419, 4549765073, 10017411248, 13736574369, 2579085006, 4549765073, 10017411248, 4549765073, 6105144164, 13765667419, 9795214235, 10017411248, 2801282019, 608404939, 4105371047, 13765667419, 8075824231, 2579085006, 4549765073, 2579085006, 6076051114, 4105371047, 8075824231, 2385981043]

 


 

Download elg_encrypt.mw

@Gibberish123 

@Christopher2222 

foobar := eval(:-changecoords)

@nk2016 

plots:-display(Array( [ [ P1, P2 ], [ P3, P4 ] ] ) );

 

@Gibberish123 The procedure rsa you show expects its second argument to be a list. So why are you trying to call it like rsa(26271227347, 11393739244) where the second argument is a scalar?

The fact that your function call to rsa returned unevaluated indicates that you have not actually made the assignment of the procedure you show (in an image, sigh) to the name rsa I suggest that you switch from 2D Input to 1D Maple Notation input, and from Document to Worksheet. See the GUI Options/Preferences.

Your procedure uses the name message. Where would that be defined? Your procedure has a parameter msg. Is the former a typo?

Your keys are very small.

Why do you ignore my suggestion to use the efficient syntax modp(Power(num,e), n) instead of the inefficient num^e mod n syntax?

Your technique of repeated list augmentation is inefficient. You could just use seq (or map) to operate over the elements of list msg, and have it be both more efficient and terse and understandable.

@Gibberish123 I don't understand why you want to do have argument msg be a list. And isn't `message` a typo for `msg`.

You seem to be ignoring everything I wrote before, as well as using several anachronistic maple programming syntax elements. It is hard to help when you don't respond directly to questions or suggestions.

Please don't repost this as yet another duplicate question, just because nobody has answered here. 

@Ronan No, there is a bug in plottools:-line that it works with unassigned names in the data. It should throw an error line `point` does. That's my opinions, anyway. Better is to delay evaluation, as I showed.

How about checking that dy/dx = 1/(-tan(t*(n+1)/n)) and consider when the denominator of that tends to zero? How often can that occur, given the bounds on t?

@vv Yes, I agree. I do not know offhand whether the following discrepancy is by design or oversight.

plottools:-line([0, 0, 0],[a,b,c]);
                   CURVES([[0., 0., 0.], [a, b, c]])

plottools:-point([a,b,c]);          
Error, (in plottools:-point) incorrect arguments for creating
 points structure, try providing the dimension option

plottools:-point([a,b,c],dimension=3);
Error, (in Plot:-Structure:-Points) points cannot be converted
 to floating-point values

@vv I gave three ways of doing it: using either unevaluation quotes, or the animate syntax (which splits command and its args), or both. Each of the three pairs (for line and point) have both calls being similar. No special difference as far as one (of the pair) goes versus the other,

I did this to contrast with your suggestion to use POINTS instead of point, which of course is indeed a special difference.

I suggest, therefore, that preventing premature evaluation (here, at least) by using uneval-quotes can work with a more consistent methodology than does replacement of command-name or use of internal structures. It's not alays true, but it is here, and often is.

@vv 
 

restart;

a := 21*arccos(RootOf(448*_Z^7+192*_Z^6-784*_Z^5-288*_Z^4
                    +392*_Z^3+108*_Z^2-49*_Z-6, index = 2))/Pi;

21*arccos(RootOf(448*_Z^7+192*_Z^6-784*_Z^5-288*_Z^4+392*_Z^3+108*_Z^2-49*_Z-6, index = 2))/Pi

b := -(21*I)*ln(RootOf(7*_Z^14+6*_Z^13+6*_Z+7, index = 2))/Pi;

-(21*I)*ln(RootOf(7*_Z^14+6*_Z^13+6*_Z+7, index = 2))/Pi

# The following works, but it's not altogether clear why.
#
evala(convert(convert(a-b,RootOf),arccos));

0

# The reason I say it's not clear is that the above works by
# virtue of turning `a` into the following form.
#
# NB. The conversion of `b` is more clear in this:
#    convert(convert(a-b,RootOf),arccos) + convert(b,arccos)
#
# NB. But that form of `a` is not done by just, say,
#    convert(convert(a,RootOf),arccos)
# which doesn't do anything.
#
simplify(convert(convert(a-b,RootOf),arccos) + convert(b,arccos));

21*arccos(-(1/2)*RootOf(7*_Z^14+6*_Z^13+6*_Z+7, index = 2)^13-(3/7)*RootOf(7*_Z^14+6*_Z^13+6*_Z+7, index = 2)^12+(1/2)*RootOf(7*_Z^14+6*_Z^13+6*_Z+7, index = 2)-3/7)/Pi

# The following turns that into `a`.
# But I would rather have the means to go the other way.
#
evala(Simplify( evalc(%) ));

21*arccos(RootOf(448*_Z^7+192*_Z^6-784*_Z^5-288*_Z^4+392*_Z^3+108*_Z^2-49*_Z-6, index = 2))/Pi

# So here is the first of two other methods to show that a = b .
#
# This works by finding a dependence relationship between
# the RootOfs.
#
evala(Indep(indets(a,specfunc(RootOf))
            union indets(b,specfunc(RootOf)),'s'));
eq := s[1];

false

RootOf(7*_Z^14+6*_Z^13+6*_Z+7, index = 2) = RootOf(-2*_Z*RootOf(448*_Z^7+192*_Z^6-784*_Z^5-288*_Z^4+392*_Z^3+108*_Z^2-49*_Z-6, index = 2)+_Z^2+1)

# The next step actually produces `a` explictly from `b`
# (That is often harder than computing that a - b = 0 and
# so this is much nicer.)
#
radnormal(convert(eval(b,eq),arccos));

21*arccos(RootOf(448*_Z^7+192*_Z^6-784*_Z^5-288*_Z^4+392*_Z^3+108*_Z^2-49*_Z-6, index = 2))/Pi

% - a;

0

# And here is another way to turn `b` into `a` directly.
#
evala(Simplify( evalc(radnormal(convert(b,arccos))) ));

21*arccos(RootOf(448*_Z^7+192*_Z^6-784*_Z^5-288*_Z^4+392*_Z^3+108*_Z^2-49*_Z-6, index = 2))/Pi

% - a;

0

# FWIW...
#
W := op(indets(b, specfunc(RootOf)));

RootOf(7*_Z^14+6*_Z^13+6*_Z+7, index = 2)

evala( evalc(abs(W)) );

1

 


Download conver.mw

[edited] When I say, "not altogether clear why" I mean that `evala` may be looking for the dependence between the RootOfs, so as to return the result having just one as preferred. So perhaps it clarifies by doing it in steps, etc.

@tomleslie By using the combine(...,units) command first you can reduce both sides to common (canonical) units, before stripping them off as unit_free.

See my Answer below, from earlier today.

@Gibberish123 I don't understand what your last Comment is about, sorry.

First 286 287 288 289 290 291 292 Last Page 288 of 592