Jump to content



Photo
- - - - -

find and replace (like find cos(2*pi*n) and replace with 1)

fx-400 programing classpad II find and replace

  • Please log in to reply
4 replies to this topic

#1 1q2w3e4rr

1q2w3e4rr

    Newbie

  • Members
  • Pip
  • 4 posts

  • Calculators:
    fx 400

Posted 13 November 2017 - 10:55 AM

HI

 

I'm trying to write a program and i want to keep it parametric

 

so in some part i have something like this:

 

P=a*sin(2*pi*n)+b*cos(2*pi*n)+n

 

and we know:

sin(2*pi*n)=0

cos(2*pi*n)=1

 

so i want to find and replace them with their Values in "P"(variable) so it would be like this:

 

P=a*0+b*1+n

P=b+n

 

thanks  :)


Edited by 1q2w3e4rr, 16 November 2017 - 06:00 AM.


#2 GodOfCows

GodOfCows

    Newbie

  • Members
  • Pip
  • 11 posts

  • Calculators:
    fx-9860gii, fx-9750gii

Posted 13 November 2017 - 03:56 PM

If it's Casio Basic then I think it would be:

 

A*0+B*1+n->P

 

 

But then on the next line you want to replace P with b+n? If so then

B+N->P

 

Sorry if it's not what you want. I am having trouble reading your question.



#3 1q2w3e4rr

1q2w3e4rr

    Newbie

  • Members
  • Pip
  • 4 posts

  • Calculators:
    fx 400

Posted 13 November 2017 - 06:49 PM

thank u  :)

but i don't know what a or b would be!! 

see i have such think like this:

(2/T)×∫(f1[i,1]×cos(((2π×n)/T)×x),x,c,T)⇒P

 

and when it calculate the parameters then i may have something like:

P=a*sin(2*pi*n)+b*cos(2*pi*n)

 

and i want some function that find "sin(2*pi*n)" and "cos(2*pi*n)" (if they are exist!) and replace them whit 0 and 1

any idea would be great :) 



#4 GodOfCows

GodOfCows

    Newbie

  • Members
  • Pip
  • 11 posts

  • Calculators:
    fx-9860gii, fx-9750gii

Posted 13 November 2017 - 11:21 PM

If you are wanting to prompt a imput then it would be:

?->A

 

 

? prompts the user to imput a value and that value will be stored into A for later calculations.

 

Example program

 

?->A

?->B

A+B

////

 

If that is not what you are wanting and are wanting to replace sin(2*pi*n) then I think you would want to do an if function:

 

If P=sin(2*pi*n)

Then 1->P

 

If P=cos(2*pi*n)

Then 0->P

 

 

 

Sorry again if thats not what you wanted, I don't think there is an exact function that will replace it but you can use the If statements.



#5 1q2w3e4rr

1q2w3e4rr

    Newbie

  • Members
  • Pip
  • 4 posts

  • Calculators:
    fx 400

Posted 16 November 2017 - 05:57 AM

If you are wanting to prompt a imput then it would be:

?->A

 

 

? prompts the user to imput a value and that value will be stored into A for later calculations.

 

Example program

 

?->A

?->B

A+B

////

 

If that is not what you are wanting and are wanting to replace sin(2*pi*n) then I think you would want to do an if function:

 

If P=sin(2*pi*n)

Then 1->P

 

If P=cos(2*pi*n)

Then 0->P

 

 

 

Sorry again if thats not what you wanted, I don't think there is an exact function that will replace it but you can use the If statements.

 

thank u again

I found an ugly way to do that :)))

 

for relapsing just cos(k.n.π)=1 jast for k=2 to 6 step 2

(2/T)×∫(f1[i,1]×cos(((2π×n)/T)×x),x,c,T)⇒an
for 2⇒i to 6 step 2
cos(i*n*π)⇒co
ExpToStr co,co
1⇒s1
while s1>0
ExpToStr an,s
strsrc s,co,s1
if s1=0 :then
goto a
ifend
strleft s,s1-1,left
strjoin left,"1",left
strlen s,len
strright s,len-(s1+9),right
strjoin left,right,s
strtoexp(s)⇒an
Lbl a
whileend
next

but its not a good cod :| I had to do this ring for sin() and I had to do it like 6 times in a program to get all I want!(for 3 variables like "an")

 

I hope someone has a better idea!







Also tagged with one or more of these keywords: fx-400, programing, classpad II, find and replace

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users