acer

32343 Reputation

29 Badges

19 years, 326 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

The problem is in how your `f*g` evaluates under evalhf (which plot uses by default when Digits=10 and UseHardwareFloats=deduced ).

`f*g`(0.002);
                          0.9184400512
evalhf(`f*g`(0.002));
                        Float(undefined)

You can work around this by either setting Digits greater than 15 (ie. greater than evahf(Digits) ) or, if you do not wish to incur the additional overhead of a higher working precision, setting UseHardwareFloats to be false. Ie,

UseHardwareFloats:=false;

Another way (which may happen to work here but might not in general...) is to massage the expression so that very large and very small multiplicative terms (each outside of the double precision range, but whose product isn't) don't occur. For example,

`f*g`:= unapply(
          combine(
            expand(
              int(f(u)*g(x-u),
                  u=x-5*sigma..x+5*sigma),
              exp)),
          x) assuming x>0, x<0.005:

Yet another approach is to try and switch from symbolic int(..) to approximate evalf(Int(...)), as long as the integrand doesn't suffer the same issue. But then you have to worry about whether the quadrature tolerance will need adjusting, or will work across the whole x-range.

The key command below is,

sort(foo, order=plex(a,b,c));

restart;

plots:-setoptions(size=[500, 200], gridlines=false);

# The internal SUM dag gets this order (due to this being
# the "first" time this subexpression is created.
# Your session's computations may have produced this
# combination at some earlier juncture.

expr := (c+b+a)/a;

(c+b+a)/a

# The same (the expression is uniquified wrt to internal
# memory) That is to say, the same issue you see with
# plot labels affects regularly output as well.

foo := (a+b+c)/a;

(c+b+a)/a

# In fact the structure of the expression reflects the
# order you see in output above.

op( numer( foo ) );

c, b, a

dismantle(foo);


PROD(5)
   SUM(7)
      NAME(4): c
      INTPOS(2): 1
      NAME(4): b
      INTPOS(2): 1
      NAME(4): a
      INTPOS(2): 1
   INTPOS(2): 1
   NAME(4): a
   INTNEG(2): -1
 

plot(sin(x), x=-Pi..Pi,
     caption = typeset((a+b+c)/a));
 

plot(sin(x), x=-Pi..Pi,
     labels=[x,expr]);

# The following command re-orders the internal
# structure (SUM dag). This has a global effect, since
# Maple only stores one instance of the sum of terms
# a,b,c in memory.
#
# Once you do this the new order is seen in both regular
# output as well as in the typeset plot label.

sort(foo, order=plex(a,b,c));

(a+b+c)/a

# The same (the expression is uniquified wrt to
# internal memory)

foo;

(a+b+c)/a

# In fact the structure of the expression reflects
# the order you see in output above. Notice how this
# is different from when this command was issued
# before the customized `sort` call.

op( numer( foo ) );

a, b, c

dismantle(foo);


PROD(5)
   SUM(7)
      NAME(4): a
      INTPOS(2): 1
      NAME(4): b
      INTPOS(2): 1
      NAME(4): c
      INTPOS(2): 1
   INTPOS(2): 1
   NAME(4): a
   INTNEG(2): -1
 

# The same (the expression is uniquified wrt to
# internal memory)

expr;

(a+b+c)/a

plot(sin(x), x=-Pi..Pi,
     labels=[x,expr]);

# You can also build your expression up in a specific
# form by using the InertForm package.

plot(sin(x), x=-Pi..Pi,
     labels=[x,InertForm:-Display(`%/`(`%+`(b,a,c),a), inert=false)]);

 


 

Download labelorder2.mw


 

restart;

 

First let's consider your Question 2), ie. how to measure the length of the string, in the sense of the number of characters that will be displayed.

 

If you convert your string to bytes then you'll see that the accented e becomes the pair 195, 169.

 

s := "dégénéré";

"dégénéré"

length(s);

12

B := convert(s,bytes);

[100, 195, 169, 103, 195, 169, 110, 195, 169, 114, 195, 169]

nops(B);

12

 

See an ASCII table at this URL.

 

So you could create your own command to compute character length (width). It could convert to `bytes` and then walk the list to do a count. When it found valid pairs above 127 (which represented a single character) then it could take that into account while counting.

 

Note that the decimal pair 195 169 also has a Unicode representation with decimal 233. I don't see how this helps especially, though. You can print that unicode entity in the Standard GUI, but its length (alone) is 6.

 

`&#233;`;

length(%);

`é`

6

 

As for Question 1) which includes printing in bold, your can get that programmatically for use with the print command by forming a piece of so-called TypeMK, which is name which represents a format somewhat similar to MathML.

 

But I don`t understand what you mean about managing the characters with the printf command. You even made a claim about selecting some text and using the B button from the menubar. But I suspect that you didn`t do that with the displayed result from printf. I don`t really understand what it would mean to manage the display of characters from a printf call. However, if you mentioned printf mostly because of the way it allows you to format and assemble the text then you might note that you could stil use sprintf or nprintf to form key parts (which needed the length metric), even if the final conglomeration is displayed using just print.

 

bolden:=(s::string)->cat(`#mn("`,s,`",fontweight = "bold")`):

sb := bolden(s);

`#mn("dégénéré",fontweight = "bold")`

print(sb);

`#mn("dégénéré",fontweight = "bold")`

 

However

 

printf("%a", sb);

#mn("dégénéré",fontweight = "bold")

`#mn("dégénéré",fontweight = "bold")`;
`#mi("dégénéré",fontweight = "bold")`;
`#mn("dégénéré",fontweight = "bold", mathcolor = "black")`;
`#mn("dégénéré",fontweight = "normal", mathcolor = "black")`;

`#mn("dégénéré",fontweight = "bold")`

`#mi("dégénéré",fontweight = "bold")`

`#mn("dégénéré",fontweight = "bold", mathcolor = "black")`

`#mn("dégénéré",fontweight = "normal", mathcolor = "black")`

 

And here is another way (for use with print, not printf ). This also allows for the font size and the font family (if available) to be specified.

 

Typesetting:-mn("dégénéré",fontweight = "bold", size="18");
lprint(%);

"dégénéré"

Typesetting:-mn("dégénéré", fontweight = "bold", size = "18")

Typesetting:-mn("dégénéré", fontfamily="DejaVu Sans", fontweight = "bold", size = "18");

"dégénéré"

Typesetting:-mn("dégénéré",fontfamily="Monospaced",mathcolor="black",size="12");
Typesetting:-mn("dégénéré",fontfamily="Monospaced",fontweight="bold",mathcolor="black",size="12");

"dégénéré"

"dégénéré"

 

 

Did you mention printf because you wanted such formatted output to be left-aligned in the worksheet?

 


 

Download chars.mw

I don't really understand why one would want to go to the trouble of using a "table" (in the non-Maple sense, with rows and columns) when the lookup could be done using the `mod` command.

(Below I retained the uppercase of your exampe in the explanation. But note that your ConvertToNumbers and ConvertToLetters work with lowercase. Hence I made use of the LowerCase and UpperCase commands from the StringTools package.)

You should be able to wrap these steps up into a pair of procedures for encoding or decoding.
 

restart;

ConvertToNumbers:=proc(L::list)

local i,M;

M:=[];

for i from 1 to nops(L) do

M:=[op(M),StringTools[Ord](L[i])-96];

if M[i]>26 or M[i]<0 then M[i]:="Errore"; end if;

end do;

return M;

end proc:

 

ConvertToLetters:=proc(L::list)

local i,M;

M:=[];

for i from 1 to nops(L) do

if L[i]>26 or L[i]<0 then M:=[op(M),"Errore"]; end if;

M:=[op(M),StringTools[Char](L[i]+96)];

end do;

return M;

end proc:

with(StringTools):

key:="LEMON";

"LEMON"

msg:="ATTACKATDAWN";

"ATTACKATDAWN"

Lkey:=ConvertToNumbers(Explode(LowerCase(key)));

[12, 5, 13, 15, 14]

Lmsg:=ConvertToNumbers(Explode(LowerCase(msg)));

[1, 20, 20, 1, 3, 11, 1, 20, 4, 1, 23, 14]

alpha:=Implode(ConvertToLetters([$1..26]));

"abcdefghijklmnopqrstuvwxyz"

m:=Length(alpha);

26

l:=nops(Lkey);

5

res:=[seq((Lmsg[i]-1+Lkey[1+(i-1 mod l)]) mod m,
          i=1..nops(Lmsg))];

[12, 24, 6, 15, 16, 22, 5, 6, 18, 14, 8, 18]

ans:=UpperCase(Implode(ConvertToLetters(res)));

"LXFOPVEFRNHR"

Lans:=ConvertToNumbers(Explode(LowerCase(ans)));

[12, 24, 6, 15, 16, 22, 5, 6, 18, 14, 8, 18]

[seq((Lans[i]+1-Lkey[1+(i-1 mod l)]) mod m,
     i=1..nops(Lans))];

[1, 20, 20, 1, 3, 11, 1, 20, 4, 1, 23, 14]

UpperCase(Implode(ConvertToLetters(%)));

"ATTACKATDAWN"

# Easier than ConvertToNumbers?
CnvrtNmbrs1:=s->map(Search,s,alpha):

CnvrtNmbrs1(Explode(LowerCase("LEMON")));

[12, 5, 13, 15, 14]

# ... and more efficiently using a Maple `table`

# create this just once
Lookup:=table([seq(alpha[i]=i,i=1..m)]):

CnvrtNmbrs2:=(s,T)->map(c->T[c],s):

CnvrtNmbrs2(Explode(LowerCase("LEMON")),Lookup);

[12, 5, 13, 15, 14]

# Easier than ConvertToLetters?
CnvrtLttrs:=L->map(n->alpha[n],L):

UpperCase(Implode(CnvrtLttrs([12,5,13,15,14])));

"LEMON"

 


 

Download vigener2.mw

I'm supposing that the task is to find some number of correct digits in the mantissa (as well as a correct integer exponent for base 10 representation).

restart;

ee := exp(t*10^37):

ff := 10^log[10](ee) assuming t<0:

simplify( ln(ee) - ln(ff) ) assuming t<0; # ok
                                     0

p := log[10](ff) assuming t<0:
pt := evalf[100](eval(p, t=-1.327553040)):

printf("\n%ae%a\n",
       evalf[20](10^frac(pt)),
       convert(evalf[37](evalf[100](pt-frac(pt))),rational,exact));

.16077954666345172195e-5765489597058869496838122557396525834

printf("\n%.20f * 10^(%a)\n",                                      
       evalf[200](10^frac(pt)+1),                                  
       convert(evalf[37](evalf[100](pt-frac(pt))),rational,exact)-1);

1.16077954666345172195 * 10^(-5765489597058869496838122557396525835)

You can use the evalf command to turn those exact Pi instances into floating-point numbers. If all the NN[i] are all floats then that will make all of NE be floats, in consequence.

Apply the evalf command around the NN[i], or around the first argument to seq, or make an evalf'd copy such as fNN:=evalf(NN) and index into that instead when constructing NE, or pass evalf(NE) instead of NE to Histogram.

I was able to confirm the buggy behaviour in 64bit Maple 17.02 for Linux (Ubuntu 14.04.4 LTS).

If it's due to some hidden/special characters then I haven't been able to identify/find such.

I was also able to reproduce it in Maple 2016.1 and Maple2016.2. I actually got it to a variant where a commented out (but invalid with mismatched brackets) 2-D Math input line would cause the GUI to misparse a subsequent long line of 1-D Maple Notation input. Please see the attached. Please note that I tried to cut down the original expression, while retaining the stange behavior, hence naturally neither output will match that of the original Question.
 

restart;

kernelopts(version);

`Maple 2016.2, X86 64 LINUX, Jan 13 2017, Build ID 1194701`

trace(expand):

## First execute the whole sheet using the !!! from the
## main menubar. Note the two outputs differ.
##
## Notoce that the next line of commented-out 2D Input
## would have mismatched brackets (delimiters) if the
## initial comment-character were deleted.
##
## Somehow the state of mismatched delimiters seen by the GUI
## during parsing *of this comment* makes the subsequent long
## 1D expression be misparsed.

NULL

expand(((o * (((h * h - h * v) * (a * h - a * v) * h * h * h * h * a * a * h - h * h * h * a * a * h * o * (h * h - h * v) * (a * h - a * v)) * a * a * h * h * h * h * h - h * h * h * a * a * h * h * h * h * h * a * a * h * (a * h - a * o) * (h * h - h * v) * (h - v)) * h * a * a * h * h * h * h * a * a * h * a * a * h * h * h * h * h - h * h * h * a * a * h * h * h * h * h * a * a * h * a * a * h * h * h * h * h * ((v * (a * h - a * v) * h * h * h * a * a * h - h * a * a * h * (h * h - h * v) * v * (a * h - a * v)) * a * a * h * h * h * h * h - h * a * a * h * h * h * h * a * a * h * (a * h - a * o) * (v * h * h * h - h * (h * h - h * v) * v))) * h * a * a * h * h * a * a * h * a * a * h * h - h * h * h * a * a * h * h * h * h * h * a * a * h * a * a * h * h * h * h * h * h * a * a * h * h * h * h * a * a * h * a * a * h * h * h * h * h * o * (((a * h - a * v) * h * a * a * h - a * a * h * o * (a * h - a * v)) * a * a * h * h - a * a * h * h * a * a * h * (a * h - a * o) * (h - v))) * h * h * a * a * h * h * h * h * a * a * h * a * a * h * h * h * h * h - h * h * h * a * a * h * h * h * h * h * a * a * h * a * a * h * h * h * h * h * h * a * a * h * h * h * h * a * a * h * a * a * h * h * h * h * h * h * a * a * h * h * a * a * h * a * a * h * h * (o * (v * (a * h - a * v) * h * h * h * a * a * h - h * a * a * h * (h * h - h * v) * v * (a * h - a * v)) * a * a * h * h * h * h * h ));

 

execute expand, args = ((o*(((h^2-h*v)*(a*h-a*v)*h^5*a^2-h^4*a^2*o*(h^2-h*v)*(a*h-a*v))*a^2*h^5-h^9*a^4*(a*h-a*o)*(h^2-h*v)*(h-v))*h^11*a^6-h^14*a^6*((v*(a*h-a*v)*h^4*a^2-h^2*a^2*(h^2-h*v)*v*(a*h-a*v))*a^2*h^5-h^6*a^4*(a*h-a*o)*(v*h^3-h*(h^2-h*v)*v)))*h^6*a^6-h^25*a^12*o*(((a*h-a*v)*h^2*a^2-a^2*h*o*(a*h-a*v))*a^2*h^2-a^4*h^3*(a*h-a*o)*(h-v)))*h^12*a^6-(v*(a*h-a*v)*h^4*a^2-h^2*a^2*(h^2-h*v)*v*(a*h-a*v))*o*h^36*a^20

-2*a^23*h^40*o*v^2+a^23*h^40*v^3+a^23*h^39*o*v^3

restart;

trace(expand):

expand(((o * (((h * h - h * v) * (a * h - a * v) * h * h * h * h * a * a * h - h * h * h * a * a * h * o * (h * h - h * v) * (a * h - a * v)) * a * a * h * h * h * h * h - h * h * h * a * a * h * h * h * h * h * a * a * h * (a * h - a * o) * (h * h - h * v) * (h - v)) * h * a * a * h * h * h * h * a * a * h * a * a * h * h * h * h * h - h * h * h * a * a * h * h * h * h * h * a * a * h * a * a * h * h * h * h * h * ((v * (a * h - a * v) * h * h * h * a * a * h - h * a * a * h * (h * h - h * v) * v * (a * h - a * v)) * a * a * h * h * h * h * h - h * a * a * h * h * h * h * a * a * h * (a * h - a * o) * (v * h * h * h - h * (h * h - h * v) * v))) * h * a * a * h * h * a * a * h * a * a * h * h - h * h * h * a * a * h * h * h * h * h * a * a * h * a * a * h * h * h * h * h * h * a * a * h * h * h * h * a * a * h * a * a * h * h * h * h * h * o * (((a * h - a * v) * h * a * a * h - a * a * h * o * (a * h - a * v)) * a * a * h * h - a * a * h * h * a * a * h * (a * h - a * o) * (h - v))) * h * h * a * a * h * h * h * h * a * a * h * a * a * h * h * h * h * h - h * h * h * a * a * h * h * h * h * h * a * a * h * a * a * h * h * h * h * h * h * a * a * h * h * h * h * a * a * h * a * a * h * h * h * h * h * h * a * a * h * h * a * a * h * a * a * h * h * (o * (v * (a * h - a * v) * h * h * h * a * a * h - h * a * a * h * (h * h - h * v) * v * (a * h - a * v)) * a * a * h * h * h * h * h ));

 

execute expand, args = ((o*(((h^2-h*v)*(a*h-a*v)*h^5*a^2-h^4*a^2*o*(h^2-h*v)*(a*h-a*v))*a^2*h^5-h^9*a^4*(a*h-a*o)*(h^2-h*v)*(h-v))*h^11*a^6-h^14*a^6*((v*(a*h-a*v)*h^4*a^2-h^2*a^2*(h^2-h*v)*v*(a*h-a*v))*a^2*h^5-h^6*a^4*(a*h-a*o)*(v*h^3-h*(h^2-h*v)*v)))*h^6*a^6-h^25*a^12*o*(((a*h-a*v)*h^2*a^2-a^2*h*o*(a*h-a*v))*a^2*h^2-a^4*h^3*(a*h-a*o)*(h-v)))*h^12*a^6-o*h^103*a^80*(v*(a*h-a*v)*h^4*a^2-h^2*a^2*(h^2-h*v)*v*(a*h-a*v))

-a^83*h^107*o*v^2+a^83*h^106*o*v^3-a^23*h^40*o*v^2+a^23*h^40*v^3

## Now, manually place the cursor on the first input line (that
## produces output. Execute it and see that now its output agrees
## with the second utput. Very weird.

 


 

Download oddity2016.mw

I will submit as a bug report (SCR).

This is not the most efficient, but is simple to use.
 

NULL

c-s > (w+u-s)*(-P[A]*P[B]+P[B])+P[A]*(p-s);

(w+u-s)*(-P[A]*P[B]+P[B])+P[A]*(p-s) < c-s

(w+u-s)*(-P[A]*P[B]+P[B])+P[A]*(p-s) > c-s;

c-s < (w+u-s)*(-P[A]*P[B]+P[B])+P[A]*(p-s)

c-s > P[A]*P[B]*(p-s);

P[A]*P[B]*(p-s) < c-s

P[A]*P[B]*(p-s) > c-s;

c-s < P[A]*P[B]*(p-s)

F1 := (w+u-s)*(-P[A]*P[B]+P[B])+P[A]*(p-s)-c+s;

(w+u-s)*(-P[A]*P[B]+P[B])+P[A]*(p-s)-c+s

F2 := P[A]*P[B]*(p-s)-c+s;

P[A]*P[B]*(p-s)-c+s

c1 := solve(F1, P[A]);

(s*P[B]-u*P[B]-w*P[B]+c-s)/(s*P[B]-u*P[B]-w*P[B]+p-s)

c2 := solve(F2, P[A]);

(c-s)/(P[B]*(p-s))

wt := 4;

4

2

2

1

7

cc1 := eval(c1, {c = ct, p = pt, s = st, u = ut, w = wt});

(-5*P[B]+1)/(-5*P[B]+6)

cc2 := eval(c2, {c = ct, p = pt, s = st, u = ut, w = wt});

(1/6)/P[B]

CC1 := piecewise(cc1 <= P[B], cc1, undefined)

piecewise((-5*P[B]+1)/(-5*P[B]+6) <= P[B], (-5*P[B]+1)/(-5*P[B]+6), undefined)

CC2 := piecewise(cc2 <= P[B], cc2, undefined)

piecewise((1/6)/P[B] <= P[B], (1/6)/P[B], undefined)

plot({CC1, CC2, P[B]}, P[B] = 0 .. .50, P[A] = 0 .. .50)

NULL

``


 

Download equilibrium_alt.mw

(Thanks to vv for Body2).

I think that the comments and a few variants might help explain some things to the OP. (I have removed output, for upload here.)

Download rotate3d.mw

Bring the multiplication by `s` inside the `mod` call, in the loop in `Elgamal`.

Don't call `proc3` each time you enter the loop in Elgamal`. Instead compute it once at  the start of `Elgamal`, and assign to a local (which you'll use inside the loop). Combined with the above, that brings it down to about 2 seconds, on a fast machine.

Use &^ instead of ^ inside the `mod` in `Elgamal`. (I've told you this more than three times now, in various questions and duplicates of questions you've made recently.) Combined with the above, that brings it down to about 0.2 seconds on a fast machine.


 

restart;

Elgamal := proc (ciphy::list, hkt, p, a, b)
               local i, icdarray, s, p3, q, x;
                 #msolve(a ^ x = b, p);
                 #p3 := subsindets(eval(x, msolve(a ^ x = b, p)),name,0);
                 p3 := proc3(a, b, p);
                 icdarray := Array(1 .. nops(ciphy));
                   for i from 1 to nops(ciphy) do
                   s := ciphy[i];
                   q := `mod`(s / hkt &^ p3, p);
                   icdarray[i] := q;
                   end do;
                   return convert(convert(icdarray,list),bytes);
                  end proc:

proc3 := proc (alpha, beta, p)
                   local k, R, i, j, N, A, t;
               description "baby step giant step procedure";
                 N := floor(sqrt(p-1))+1;
                 A := Array(0 .. N);
                 for j from 0 to N do
                 A[j] := `mod`(alpha&^j, p);
                end do;
          for i from 0 to N do
             t := `mod`( ( beta * alpha &^ (-N*i) ), p);
            for k from 0 to N do
            if t = A[k]
           then return k+N*i;
         end if;
         end do;
           end do;
         end proc:

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]:

 

Elgamal( ciphertext, header, 14654455471, 457454, 13954306945);

"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'."

 


 

Download elgamal2.mw

Are you asking how you can make sure that you're always invoking the command that is not in the plots package? If so then just call it using the global name, ie.

:-changecoords

The name `s` appears in eqset. Is that not the same global name as you're trying to use for the do-loop?

When you call dsolve (numeric) you can pass it the additonal option output=listprocedure. If you assign the result to sol then the following allows you to extract the functions individually. Eg,

sF__A := eval(F__A(V), sol):
After which you can call,
sF__A(0.1e-4);
which should then return the single numeric value, say, HFloat(3.498873118476744e-6).
restart:

targ:=(sin(t)*sin(t/n)-cos(t)*cos(t/n)) /( sin(t)*cos(t/n)+cos(t)*sin(t/n));

                         sin(t) sin(t/n) - cos(t) cos(t/n)
                 targ := ---------------------------------
                         sin(t) cos(t/n) + cos(t) sin(t/n)

res:=(cos(t/n)*sin(t/n)-sin(t)*cos(t))/(cos(t/n)^2-cos(t)^2);

                         cos(t/n) sin(t/n) - sin(t) cos(t)
                  res := ---------------------------------
                                       2         2
                               cos(t/n)  - cos(t)

simplify(targ-res);                                                                 

                                        0

normal(expand(trigsubs(numer(combine(res)))[1]
              /trigsubs(denom(combine(res)))[1]));

                        sin(t) sin(t/n) - cos(t) cos(t/n)
                        ---------------------------------
                        sin(t) cos(t/n) + cos(t) sin(t/n)

% - targ;

                                       0

alt:=convert(trigsubs(numer(combine(res)))[1]
             /trigsubs(denom(combine(res)))[1],cot);

                                     t (n + 1)
                         alt := -cot(---------)
                                         n

simplify(targ-alt);

                                       0


 

restart;

with(plots):
with(plottools):

L:=[cos(0.25*t)+0.2*sin(0.25*t),
    sin(0.25*t)-0.2*cos(0.25*t),
    0.0];

ff1:=unapply('display'(['line'([0, 0, 0],L,colour=red,
                               thickness=4)]),
             t):

animate(ff1,[t],t=0..5,frames=100);

animate(display@line,
        [[0,0,0],L,colour=red,thickness=4],
        t=0..5,frames=100);

animate(display,
        ['line'([0,0,0],L,colour=red,thickness=4)],
        t=0..5,frames=100);

ffp:=unapply('display'('point'(L,colour=red,
                               symbolsize=50,
                               symbol=solidsphere)),
             t):

animate(ffp,[t],t=0..5,frames=100);

animate(display@point,
        [L,colour=red,symbolsize=50,
         symbol=solidsphere],
        t=0..5,frames=100);

animate(display,
        ['point'(L,colour=red,symbolsize=50,
                 symbol=solidsphere)],
        t=0..5,frames=100);

 


 

Download delayedevaluation.mw

First 199 200 201 202 203 204 205 Last Page 201 of 336