Some extra math functions

About advanced scenes, and the Thyme scripting language used in Algodoo.

Re: Some extra math functions

Postby Mr. crash » Mon Feb 15, 2010 8:47 pm

canadian joe wrote:HOW DO PEOPLE COME UP WITH THESE KINDS OF SCRIPTS! Compared to this script i have the skills of a cheesecake..............a dead cheesecake. I probably just don't know scripting language that well

yea I don't know really much about scripting too.... I know some normal things like some variables and spawning...
I like crashes alot!
User avatar
Mr. crash
 
Posts: 266
Joined: Fri Sep 18, 2009 9:56 pm
Location: Joensuu, Finland

Re: Some extra math functions

Postby Mystery » Sat Feb 20, 2010 7:30 am

When i started thyme all i could do was copy and paste code into the console from there i worked my ways up, every time i saw a scene i would work out how the codes work (With the exception of kilinch's scenes :D)
User avatar
Mystery
 
Posts: 2802
Joined: Thu Sep 03, 2009 1:16 pm
Location: Southern Australia

Re: Some extra math functions

Postby xplane80 » Sat Feb 20, 2010 2:28 pm

Mystery wrote:When i started thyme all i could do was copy and paste code into the console from there i worked my ways up, every time i saw a scene i would work out how the codes work (With the exception of kilinch's scenes :D)

Same but I know a programming language so thyme became easy to learn. Kilinch's scenes aren't that complicated. All he does it but things down to there basics and then codes it from there.
Image<- Designed by PhysicsGuy
User avatar
xplane80
 
Posts: 498
Joined: Mon Aug 31, 2009 7:28 pm

Re: Some extra math functions

Postby Mystery » Mon Feb 22, 2010 1:16 pm

The level of math Kilinch uses is beyond what I've learnt the code structure i can understand perfectly.
User avatar
Mystery
 
Posts: 2802
Joined: Thu Sep 03, 2009 1:16 pm
Location: Southern Australia

Re: Some extra math functions

Postby Rideg » Wed Mar 10, 2010 5:12 pm

It was easy to learn and I've never programmed before ;P
Image
make sure to check out my work.
User avatar
Rideg
 
Posts: 948
Joined: Tue Dec 15, 2009 5:17 pm
Location: Östersund, Sweden

Re: Some extra math functions

Postby xplane80 » Wed Mar 10, 2010 7:58 pm

Rideg wrote:It was easy to learn and I've never programmed before ;P

Learning time isn't hard. In fact, it is really easy.
Just follow a thyme tutorial off the forums or if you really want so more help, I *might* make a video tutorial for everyone.
Image<- Designed by PhysicsGuy
User avatar
xplane80
 
Posts: 498
Joined: Mon Aug 31, 2009 7:28 pm

Math.abs

Postby phunHunger » Sun May 23, 2010 2:41 pm

Could you not use ^-2 instead of an if command?

Thats what I use.
Noobs are the best ;)
User avatar
phunHunger
 
Posts: 31
Joined: Mon Apr 26, 2010 10:01 pm

Re: Some extra math functions

Postby Rideg » Sun May 23, 2010 10:55 pm

yes I always use that do keep the code length down and cuz Ima lazy :lol:
Image
make sure to check out my work.
User avatar
Rideg
 
Posts: 948
Joined: Tue Dec 15, 2009 5:17 pm
Location: Östersund, Sweden

Re: Some extra math functions

Postby DrAgon » Sat Feb 11, 2017 10:37 pm

About the logarithm-coding with thyme: I used
Code: Select all
scene.my.intln2of:=(a,b)=>{
{a>2}?{c=a/2.0;d=b+1;scene.my.intln2of(c,d)}:{[a,b]}}

which returns [a/2^highestpowerof2,highestpowerof2]
then i do
Code: Select all
scene.my.logar:=(k)=>{m=scene.my.intln2of(k,0); q=m(0);r=m(1);
t=q^0.125;
x=t-1;
xx=x*x;
xxx=xx*x;­
xxxxxx=xxx*xxx;
z=x-xx/2+xxx/3-xxx*x/4+xxx*xx/5-x­xxxxx/6+xxxxxx*x/7-xxxxxx*xx/8+xxxxxx*xxx/9;
resu=­r*0.6931471806+8*z;
}

which gives e.g. ln(1.999)= 0.69264704
nice in comparison to the real 0.692647055
or ln(12345)=9.421007
nice in comparison to the real 9.4210064

There are built-in-functions now for logarithm now, which are
math.log for natural logarithm, and
math.log10 for the base 10 log.
User avatar
DrAgon
 
Posts: 31
Joined: Tue Feb 12, 2013 4:03 pm

Re: Some extra math functions

Postby The Linkage » Tue Feb 28, 2017 7:05 pm

That was a massive bump! 7 years... :lol:
The Linkage
 
Posts: 57
Joined: Fri Aug 05, 2011 5:40 pm
Location: Escobar, Argentina

Previous

Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 9 guests