Jump to content



Photo
- - - - -

Exact Values


  • Please log in to reply
16 replies to this topic

#1 genesis

genesis

    UCF BASIC Programming Runner Up

  • Super Member
  • PipPipPipPip
  • 281 posts
  • Location:Perth, Australia
  • Interests:Speaking German, computers, defending CFX calculators...

  • Calculators:
    CFX 9850 GB+

Posted 04 March 2005 - 03:16 PM

I have written a program that works just like RUN mode, but gives answers in exact values, that is displaying surds (in simplest form) and fractions (rationalised) simultaneously (even for trigonometry!) Here it is, please give me your opinions, feedback... so far I haven't found any errors, but it's slow for large numbers:

ClrText
?->A:A:Rnd
Frac Ans=0=>Stop:0->B
Do
Isz B:A?B?:Rnd
LpWhile Frac Ans≠0
If Frac √Ans=0
Then 1->C:√Ans->D
Else Ans->C:1->D
While Frac C/4=0
2D->D:C/4->C
WhileEnd
For 3->E To √C Step 2
While Frac C/E?=0
DE->D:C/E?->C
WhileEnd
Next
IfEnd
If B=1
Then If A<0
Then If D=1
Then Locate 19-Int log C,3,"-"
Else Locate 19-Int log D,3,"-"
IfEnd
IfEnd
D≠1=>Locate 19-Int log C-Int log D,3,D
Locate 20-Int log C,3,"√"
Locate 21-Int log C,3,C
Else If C=1
Then A<0=>Locate 18-Int log B-Int log D,3,"-"
Locate 19-Int log B-Int log D,3,D
Else If A<0
Then If D=1
Then Locate 17-Int log B-Int log C,3,"-"
Else Locate 16-Int log B-Int log C-Int log D,3,"-"
IfEnd
IfEnd
D≠1=>Locate 17-Int log B-Int log C-Int log D,3,D
Locate 18-Int log B-Int log C,3,"√"
Locate 19-Int log B-Int log C,3,C
IfEnd
Locate 20-Int log B,3,"/"
Locate 21-Int log B,3,B
IfEnd
NOTE: ?-squared √-root ≠-does not equal /-fraction "-"-"negative sign"
- The first and second Frac tests skip straight to the answer for rational numbers.
- The inputted number is rounded to the specified number of significant figures (10 in normal mode) to account for errors accumulated when multiplying surds.
- The first While loop (While is better than Do, as Do must always be run once) rationalises the denominator.
- The next two While loops simplify the surd in the numerator.
- Logs are used to position the numbers perfectly in place.
- I am currently working on logarithm, trigonometry and radian display.

#2 dscoshpe

dscoshpe

    Casio Freak

  • [Legends]
  • PipPipPipPip
  • 185 posts
  • Location:California, USA

  • Calculators:
    AFX 2.0 (v1.00), 9850Ga+, 9800, BE-300 other..

Posted 05 March 2005 - 06:11 AM

Hey this is pretty cool! Back before I got my AFX I always wished for some more precision so this would have been welcome, the fraction display is also convenient. But for AFX users the CAS meets the need...

- dscoshpe -

#3 genesis

genesis

    UCF BASIC Programming Runner Up

  • Super Member
  • PipPipPipPip
  • 281 posts
  • Location:Perth, Australia
  • Interests:Speaking German, computers, defending CFX calculators...

  • Calculators:
    CFX 9850 GB+

Posted 05 March 2005 - 09:01 AM

The code has been updated to fix rounding errors. Please continue to test it, I think there may be more... :unsure:
Points to consider:
- There is currently ambiguity between √(a/b) and (√a)/b, what symbol should I use, fraction, "/", or the division sign?
- Is there a faster way to find the denominator than trying out numbers starting from 1?
- Any ideas for logarithm, trigonometry and radian display? I'm not sure how I should display answers... a single exact value, one over another etc?

#4 Guest_CFX & FX Owner_*

Guest_CFX & FX Owner_*
  • Guests

Posted 08 March 2005 - 04:09 PM

This program is really great on my CFX-9850GB+!!! My friend saw this program on my calculator and wondered if anyone can convert the program to TI Basic for him. My friend has a TI-84. :D

#5 Guest_CFX & FX Owner_*

Guest_CFX & FX Owner_*
  • Guests

Posted 08 March 2005 - 08:09 PM

This program is really great on my CFX-9850GB+!!! My friend saw this program on my calculator and wondered if anyone can convert the program to TI Basic for him. My friend has a TI-84. :D

<{POST_SNAPBACK}>


If someone has managed to covert this program to TI-84 Basic format, please post the text here on this thread. :D

#6 Andy.Davies

Andy.Davies

    Forum Ghost

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1547 posts
  • Gender:Male
  • Location:Dorset, England
  • Interests:Age: 18
    Studying: MEng in cybernetics at Reading uni
    Interests: Progaming (VB, VB.Net, C#, Casio Basic)
    Computers UBBD (Using, Building, Breaking &amp; Destroying)
    Gaming (FPS, RTS, RPG)
    Electronics
    Rock Music (Preferably Loud)
    Riley's (Pool &amp; Snooker Bar)
    Driving (Preferably fast)
    Aikedo (Martial Art)

  • Calculators:
    Algebra FX 2.0 ROM 1.01, FX9750G

Posted 09 March 2005 - 01:06 AM

you know it would be helpful to put the link in, rather than an underlined piece of text....

:P

#7 octobclrnts

octobclrnts

    Casio Freak

  • Members
  • PipPipPipPip
  • 145 posts
  • Location:Pennsylvania, United States
  • Interests:Computers<br />Programming languages<br />Artificial Intelligence<br />Music (clarinet)

  • Calculators:
    Casio CFX 9850GB Plus
    Ti-89 Titanium

Posted 09 March 2005 - 03:29 AM

The only problem with converting this code is that TI basic doesn't have a locate command (at least not that I know of). That may present a problem... :(

#8 Guest_Guest_*

Guest_Guest_*
  • Guests

Posted 09 March 2005 - 04:11 PM

The only problem with converting this code is that TI basic doesn't have a locate command (at least not that I know of).  That may present a problem... :(

<{POST_SNAPBACK}>


I think TI's have an Output command where it king of does the same thing as locate...
I'm not sure though...

#9 CrimsonCasio

CrimsonCasio

    UCF Ambassador

  • [Legends]
  • PipPipPipPipPipPipPipPipPipPip
  • 3579 posts
  • Gender:Male
  • Location:USA
  • Interests:Claculators, Stephen King, Video Games, Calculators, Programming, Calculators, Reading, Calculators... hmm, what else... Ah! Calculators!

  • Calculators:
    Algebra FX2.0, CFX 9850Ga+, Classpad 300

Posted 09 March 2005 - 06:09 PM

yes, but the X and Y values are reversed as i recall.

#10 Guest_Guest_*

Guest_Guest_*
  • Guests

Posted 10 March 2005 - 05:59 PM

This program is really slow. Make it faster!!!

#11 huhn_m

huhn_m

    Casio Maniac

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1957 posts
  • Gender:Male
  • Location:Germany / Dresden
  • Interests:Assembler(!!!)
    Computers and Programming
    Operating Systems
    Programmable Calculators
    Maths and everything arround it

  • Calculators:
    FX-82SX / AFX 2.0+ (ROM 1.03) / FX 1.0+ (ROM 1.03)

Posted 10 March 2005 - 06:04 PM

you are funny ... how?

Your calc is really slow. Make it faster ...

There IS no way to make Casio Basic faster - you could just replace the
processor.

#12 Guest_Guest_*

Guest_Guest_*
  • Guests

Posted 14 March 2005 - 10:42 PM

you are funny ... how?

Your calc is really slow. Make it faster ...

There IS no way to make Casio Basic faster - you could just replace the
processor.

<{POST_SNAPBACK}>


You know, you could just re-write the program and write a faster one? Have you thought about that? :lol2:

#13 genesis

genesis

    UCF BASIC Programming Runner Up

  • Super Member
  • PipPipPipPip
  • 281 posts
  • Location:Perth, Australia
  • Interests:Speaking German, computers, defending CFX calculators...

  • Calculators:
    CFX 9850 GB+

Posted 16 March 2005 - 10:57 AM

You know, thats WHY I'm asking for people's opinions because I KNOW its not perfect... If it was perfect, I wouldn't be asking!

The trouble is separating the numerator from the denominator, is there a better way than just testing all the numbers starting from 1? Also, I'm squaring the surds, which is causing problems, is there a way to test surds for divisibility? I could make it that you input each separately, but that defeats the purpose of a all-purpose calculator.

#14 TacoFred

TacoFred

    Casio Freak

  • Members
  • PipPipPipPip
  • 145 posts
  • Location:NJ
  • Interests:I LOVE STARCRAFT BROODWAR<br />MUHAHAHAHAHAHAHAHAHAHAHA

  • Calculators:
    cfx 9850gb+, fx 115MS, ClassPad 300, TI-89 Titanium

Posted 16 March 2005 - 11:35 AM

i was testing this, and put in sqrt(48), and it printed 8 sqrt(0)...
so...what is this exactly supposed to do?

#15 liquid

liquid

    Wannabe Casio God

  • Members
  • PipPipPip
  • 66 posts
  • Gender:Male
  • Location:NZ

  • Calculators:
    fx 9750 Plus

Posted 07 April 2005 - 04:51 AM

Yea there seem to be some errors. I entered sqrt(2) and it gives 2sqrt(0)?
But still this is a great program as my 9750 obviously has no cas capability.

I was just thinking that you should edit the program to show the number in decimal from as well beneath it, and then show the decimal form of what it thnks the anwer is. This way you can tell how accurate the answer is and obviouly if its giving a bogus result.

Tip: change start to
ClrText
?->A:A:Rnd
" "
Frac Ans=0=>Stop:0->B
Do

then change end to:
IfEnd
Locate 20-Int log B,3,"/"
Locate 21-Int log B,3,B
IfEnd
A

just adding that A on the end shows the original number in decimal and those " " at the start stops it writing over the Locate stuff.
Can you change it so that it gives another decimal answer that is interpreted from the anwer that the program gives as i explained above?

#16 Guest_vishak_*

Guest_vishak_*
  • Guests

Posted 15 April 2005 - 09:04 AM

can somebody give me such a program which works on fx-911z

thanks

#17 genesis

genesis

    UCF BASIC Programming Runner Up

  • Super Member
  • PipPipPipPip
  • 281 posts
  • Location:Perth, Australia
  • Interests:Speaking German, computers, defending CFX calculators...

  • Calculators:
    CFX 9850 GB+

Posted 07 May 2005 - 04:40 AM

Sorry for bringing this up again, but what calc are you using? I've tested the program thoroughly, and it produces no such results (your results are also impossible given the code). Remember, it was originally intended for displaying exact values for trigonometic functions, and it is obviously slower for rational numbers (common sense states that you just use the RUN menu...), so don't compare my program's speed to the calculators!

And yes, my program does give bogus results for large numbers, as the calculator doesn't store surds or large numbers to a great deal of accuracy... I don't think its possible to fix it without removing the user interface.

As for the tip, perhaps it would be faster to show the raw value first and the calculated value at the end.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users