## 5 Reputation

13 years, 238 days

## Counting Characters in String...

Maple

Hi I'm trying to write a proc to takes a character and a string as inputs and as output tells you how many times the character shows up in the string.
I don't know what is wrong with the code

s:=proc(Z)

`local counts,C,i,L:for C from "a" to "z" do counts[C]:= 0:end do:L:=length(Z):for i from 1 to L   doC:=Z[i];if C >= "a" and C <= "z" thencounts[C] := counts[C] + 1end if;print(C,counts):`

## Help can anyone see the problem in my pr...

Maple

Code

`L:={NULL}:for q from 11 to 100check:=0:for p from 1 to 200n:=length(p):for i from 1 to na[i]:=p[i]:s:=sum(a[i],i=2..n)if p-a[1]-10*s*modq=0 thencheck:=check+1:if check=200 then L:=L{op(L),q}:print(L);and the pseudocode:`
`1. L is the empty set2. for q from 11 to 1003. check=04. for p from 1 to 2005.  find n, the number of digits of p6. for i from 1 to n7. find a[i], the ith digit of p`

## Plotting Fern , Help...

Maple

Here is my code , could you please tell me where i'm going wrong... isn't plotting anything

Fern :=proc(n);
local pick,n;
n := NULL;
for n from 1 to n do
pick := rand();
if pick < 0.01 then
x[n+1] := 0;
y[n+1] := 0.16*y[n];

else if pick < 0.01 + 0.85 then
x[n+1] := 0.85*x[n] + 0.04*y[n] + 0;
y[n+1] := -0.04*x[n] + 0.85*y[n] + 1.6;
else if pick < 0.01 + 0.85 + 0.07 then
x[n+1] := 0.2*x[n] - 0.26*y[n] + 0;
y[n+1] := 0.23*x[n] + 0.22*y[n] + 1.6;

## Maple Q's Help Plz...

Maple , MapleNet , MapleSim

Question: (how to do this)

Write a procedure that takes as input a lowercase text string and returns a list 26 integers.
the fist entry is a count of the number of letter 'a's,the second the number of lette 'b's ,.... , the 26th the numberof letter 'z'.

Thank you

 Page 1 of 1
﻿