Adept Scientific - English
The world's best software and hardware for research, science and engineering.
flag arrow
clearclear

 Adept Store | register Join My Adept | Flags  
Adept Scientific | Amor Way | Letchworth Garden City | Herts | SG6 1ZA | Tel: +44 (0)1462 480055  
UKdedksvnofi
Home
Products
Training
Events
 Buy Online
Downloads
Academic Discounts
Support
My Adept
International |  About Us |  Adept Scientific Blog |  Contact Us |  Press Room |  Jobs
Adept Scientific on Facebook Adept Scientific on Twitter Adept Scientific on YouBube Adept Scientific on LinkedIn


The Next Steps

• Ask us a question
• Watch Maple Video Demonstrations
• Buy Maple Now
• View Maple Pricing
• Download a Brochure
• Request an Evaluation
• Meet Our Team
• Read our RSS Feeds

Learn More

Maple Home
Maple 17 Overview
Maple 17 Professional
Maple 17 Academic
Maple 17 Student Use
What's New in Maple 17
Maple Features
Maple History
Recorded Online Seminars

MapleSim
MapleNet
Maple T.A.
BlockImporter™
Maple Toolboxes
The Möbius Project

Maple Rave Reviews
Maple Study Guides
Books about Maple
System Requirements

Latest Information

New Features: Professional
New Features: Academic
Maple Features
The Maple Reporter Online

Service & Support

Maple Primes
blogs, forums etc

Elite Maintenance Program
Application Centre
Powertools
Search the Knowledge Base
Technical Support request

List Archives >  Maple User Group List Archive >  Archive by date >  This Month By Date >  This Month By Topic

[MUG] Re: Character Sequences

Search email archive for  

[MUG] Re: Character Sequences
Author: Maple Group    Posted: 28/06/2001 13:46:55 GDT
>> From: Maple Group

| >> From: "Nathan Sokalski"
|
| Does anybody know of a way to calculate a sequence of characters, perhaps
| using either the seq(), $ or .. functions? I could not find a function to
| use in the seq() function, and nothing that I tried using the $ and ..
| worked. Did I miss a function that can be used in seq()? Is there a way to
| use $ and .. that will work? Is there some other way altogether that I can
| use to create a character sequence?

-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-

Date: Thu, 21 Jun 2001 13:35:35 -0700
From: Allan Wittkopf
To:
Subject: Character Sequences


You could try:

> convert([seq(i,i=65..65+25)],bytes);

"ABCDEFGHIJKLMNOPQRSTUVWXYZ"

> convert([seq(i,i=97..97+25)],bytes);

"abcdefghijklmnopqrstuvwxyz"

> convert(%,bytes);

[97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,

111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122]


Sincerely,
Allan Wittkopf


-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-

Date: Fri, 22 Jun 2001 03:24:52 +0200
From: Helmut Kahovec
To:
Subject: Character Sequences

Well, I hope that the following will help you:

> restart;
> seed:=randomize();

seed := 993172925

> rg:=rand(1..52):
> chars:=convert([$65..90,$97..122],bytes);

chars := "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"

> seq(chars[rg()],i=1..20);

"D", "g", "N", "e", "V", "c", "r", "p", "L", "j", "T", "l", "f",

"E", "h", "N", "M", "X", "v", "e"

> password1:=cat(``,%);

password1 := DgNeVcrpLjTlfEhNMXve

> password2:=cat(%%);

password2 := "DgNeVcrpLjTlfEhNMXve"

Don't use single letter names when doing the following:

> seq(convert(chars[rg()],name),i=1..20);

e, k, x, M, y, F, u, f, X, T, R, m, N, V, w, p, L, R, d, i

> password3:=cat(%);

password3 := ekxMyFufXTRmNVwpLRdi

> password4:=cat("",%%);

password4 := "ekxMyFufXTRmNVwpLRdi"


With kind regards,

Helmut


-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-

Date: Thu, 21 Jun 2001 19:27:09 -0700 (PDT)
From: Robert Israel
To:
Subject: Character Sequences


Characters in Maple are the same as single-letter strings. I don't
know what your difficulty is, unless you're using a version of Maple
before Release 5 (where the string type was first introduced). You
can use, e.g.

> seq(c,c="a".."d");

or

> $"a".."d";

Robert Israel
Department of Mathematics http://www.math.ubc.ca/~israel
University of British Columbia
Vancouver, BC, Canada V6T 1Z2


-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-

Date: Fri, 22 Jun 2001 08:25:24 -0400
To:
From: "Gerald A. Edgar"
Subject: Character Sequences

It's not entirely clear what you want...
Perhaps something like this?

> str1 := "";
> for x from "a" to "z" by 2 do str1 := cat(str1,x) od:
> str1;
str1 := ""

"acegikmoqsuwy"
> str1[3..7];
"egikm"

Or perhaps this?

> cat("a" .. "j");
a, b, c, d, e, f, g, h, i, j

--
G. A. Edgar http://www.math.ohio-state.edu/~edgar/


-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-

From: Stanley J Houghton
Date: Fri, 22 Jun 2001 14:54:37 +0100
To:
Subject: Character Sequences


You can always use convert with the bytes option (which converts
strings to ascii codes and back).

> convert([i$i=65..68],bytes); # gives "ABCD"

or for a sequence

> seq(convert([i],bytes),i=65..68); # gives "A","B","C","D"

If you wish you can also convert the strings to names (convert with
name option).

Hope it helps
Stan

-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-

Date: Fri, 22 Jun 2001 10:09:47 -0700
From: "Joe Riel (home)"
To:
Subject: Character Sequences

> alphabet := "abcdefghijklmnopqrstuvwxyz":
> seq(alphabet[i],i=3..5);
"c", "d", "e"

> cat(%);
"cde"

Joe Riel


-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-

Date: Fri, 22 Jun 2001 19:29:40 -0400 (EDT)
From: Carl DeVore
To:
Subject: Character Sequences

Here's 6 distinct ways to create sequences of single-character strings:

> $ "d".."m";

"d", "e", "f", "g", "h", "i", "j", "k", "l", "m"

> seq(i, i= "A string.");

"A", " ", "s", "t", "r", "i", "n", "g", "."

> "A string."[i] $ i= 3..8;

"s", "t", "r", "i", "n", "g"

> S:= NULL: for i in "A string." do S:= S, i od: S;

"A", " ", "s", "t", "r", "i", "n", "g", "."

> sscanf("A string.", cat("%c" $ 10))[];

"A", " ", "s", "t", "r", "i", "n", "g", "."

> convert("A string.", list)[];

"A", " ", "s", "t", "r", "i", "n", "g", "."


I'm not sure if this is exactly what you had in mind. Let me know.



[View Complete Thread]



Previous by date: [MUG] Ranges in procedure argument list.,  CH'NG Man Yang
Next by date: [MUG] Re: problem with set usage, Maple Group
Previous thread: [MUG] convert/string,  Nathan Sokalski
Next thread: [MUG] Re: problem with set usage, Maple Group



Ready to buy?

For more pricing information:
Visit our webstore, call us on +1 800 724 8380 or email us at info@adeptscience.com

Featured Downloads

Maplesoft Product Catalogue
Maple Player for iPad - Datasheet
Maple 17 What's New datasheet
Maple 17 Professional Datasheet
Maple Whitepaper: Driving Innovation - How mathematical modeling and optimisation increase efficiency and productivity in vehicle design.
MapleSim Whitepaper - Technological Superiority in Multi-Domain Physical Modelling and Simulation

Latest Downloads

Maple - Global Optimization Toolbox
The Möbius Project - Create it, Share it, Grade it
Maple 17 Programming Guide
Maple 17 User Manual
Maplesoft Product Catalogue - Academic Maths

Product Reviews

"Without the Maple software, we would have to spend weeks generating the equations of motion for every experiment. Then the chances that we did it right would basically be near zero. There would always be a mistake somewhere. It is very difficult to set up a dynamic motion model by hand."
- Jean-Claude PiedBeouf, Ph.D Manager of Robotics, Canadian Space Agency

"Its very good - highly accurate and easy to use. The speed of Maple allows me to change equations and quickly reintegrate them into the application, so more possibilities can be explored to achieve the precise effect desired."
Shawn Neely, Senior R & D Director for PDI/Dreamworks

Latest News

Global Optimization Toolbox: Better Optimization to Solve More Problems, Faster
Global Optimization Toolbox: Better Optimization to Solve More Problems, Faster
New MapleSim release delivers advanced model development and analysis, extended toolchain connectivity and quicker results
Maple 17 offers advanced solving and application development capabilities
New release of Maple advances teaching and research
adept

Top of the Page

Popular Links: ChemDraw | ChemOffice | Data Acquisition | Data Analysis | EndNote | Maple | MapleSim | Mathcad | MathType | Quality Analyst | Reference Manager | VisSim

EU ePrivacy Directive | Our Privacy and Terms and Conditions Statement
All Trademarks Recognised. Copyright © 2013, Adept Scientific Ltd.
Site designed and maintained by Lyndon Ash

Adept Scientific | Amor Way | Letchworth Garden City | Herts | SG6 1ZA | Tel: +44 (0)1462 480055