Be a Supporter!

Best Language for Maths?

  • 857 Views
  • 16 Replies
New Topic Respond to this Topic
bumcheekcity
bumcheekcity
  • Member since: Jan. 19, 2003
  • Offline.
Forum Stats
Member
Level 27
Blank Slate
Best Language for Maths? 2004-09-12 12:33:39 Reply

Simple question, which programming language that isn't 100% impossible to learn, is the best for calculating maths functions. Bearing in mind that I use PHP and ASP most of the time, i'm looking for something to calculate things like this:

<?php
$link = mysql_connect("localhost", "bumcheek_andreas", "andreas")
or die("Could not connect : " . mysql_error());
mysql_select_db("bumcheek_bumcheekcity") or die("Could not select database");

$n = 1;

while ($n < 40756)
{
$query = "SELECT * FROM euler45 WHERE `id` = $n";
$result = mysql_query($query);
$tri = mysql_result($result,0,"tri");

$query = "SELECT * FROM euler45 WHERE `pent` = $tri";
$result = mysql_query($query);
$num2 = mysql_num_rows($result);

$query = "SELECT * FROM euler45 WHERE `hex` = $tri";
$result = mysql_query($query);
$num3 = mysql_num_rows($result);

if (($num2==$num3) && ($num2==1))
{
echo "$n, triangle number $tri, is a solution.";
} else {
echo "$n, triangle number $tri, is not a solution";
}

$n++;
}
?>

a LOT faster than PHP and mySQL seem to be doing it, which is currently 'bloody slow'

I've had suggestions that I use C/C++, and people suggesting that I do the PHP/mySQL on my ownb machine, which I dont want to do. So, is there any language you would recommend to me to use?

LordAba
LordAba
  • Member since: Nov. 2, 2000
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
Response to Best Language for Maths? 2004-09-12 12:55:28 Reply

At 9/12/04 12:33 PM, bumcheekcity wrote: Simple question, which programming language that isn't 100% impossible to learn, is the best for calculating maths functions.

FORTRAN! I mean, it stands for formula translation, so you can't go wrong!


What may man within him hide, though angel on the outward side.

BBS Signature
BuRnBoY
BuRnBoY
  • Member since: Feb. 29, 2004
  • Offline.
Forum Stats
Member
Level 13
Blank Slate
Response to Best Language for Maths? 2004-09-12 13:54:30 Reply

maybe it's not such a good idea posting your MYSQL password in public.. just replace it with summin like "OMGsecret" or w/e.

bumcheekcity
bumcheekcity
  • Member since: Jan. 19, 2003
  • Offline.
Forum Stats
Member
Level 27
Blank Slate
Response to Best Language for Maths? 2004-09-12 15:31:23 Reply

Sorry i couldn't resist loging into his account.
Seriously buncheek, change your password.
-F-13

Sir-Davey
Sir-Davey
  • Member since: Jul. 9, 2001
  • Offline.
Forum Stats
Supporter
Level 19
Blank Slate
Response to Best Language for Maths? 2004-09-12 15:32:43 Reply

Lol that was fun.


BBS Signature
Locriology
Locriology
  • Member since: Apr. 25, 2003
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to Best Language for Maths? 2004-09-12 16:52:56 Reply

Well any language can do basic mathematical operations, so just use the easiest language. Something like Qbasic; it's fast and takes about 2 seconds to write a program.

bumcheekcity
bumcheekcity
  • Member since: Jan. 19, 2003
  • Offline.
Forum Stats
Member
Level 27
Blank Slate
Response to Best Language for Maths? 2004-09-13 17:28:01 Reply

At 9/12/04 03:31 PM, bumcheekcity wrote: Sorry i couldn't resist loging into his account.
Seriously buncheek, change your password.
-F-13

That is like, the billionth time I've done that. How do you log in to someone else's account in phpMyAdmin or something?

schorhr
schorhr
  • Member since: May. 28, 2002
  • Offline.
Forum Stats
Member
Level 11
Blank Slate
Response to Best Language for Maths? 2004-09-13 18:16:45 Reply

Well, write a php script or use phpmyadmin to access it :)

Anyway, installing php localy with www.xampp.org is a nice way.

bumcheekcity
bumcheekcity
  • Member since: Jan. 19, 2003
  • Offline.
Forum Stats
Member
Level 27
Blank Slate
Response to Best Language for Maths? 2004-09-13 19:20:26 Reply

yeah, ive had 'ol Bummy's password for a while now...
;) but leave it how it is, we all like it :-)

Taylor
Taylor
  • Member since: Aug. 19, 2003
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to Best Language for Maths? 2004-09-13 19:20:49 Reply

At 9/13/04 07:20 PM, bumcheekcity wrote: yeah, ive had 'ol Bummy's password for a while now...
;) but leave it how it is, we all like it :-)

OMG I ARE A HAX0R!!!

Sar-Casm
Sar-Casm
  • Member since: Dec. 13, 2002
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to Best Language for Maths? 2004-09-14 01:18:53 Reply

Realistically something like C/C++ is the best you'll get. Although there certainly are better languages for the job, they just don't have implementation/documentation to be viable. Functional programming languages are not necessarily better overall in mathematics because they still use the same 'object-level' (not to be confused with object-oriented programming) system as with any imperative language.

Wonderer
Wonderer
  • Member since: Nov. 29, 2003
  • Offline.
Forum Stats
Member
Level 04
Blank Slate
Response to Best Language for Maths? 2004-09-14 06:02:51 Reply

what the hell is this about?
lol

Best Language for Maths?

Sir-Davey
Sir-Davey
  • Member since: Jul. 9, 2001
  • Offline.
Forum Stats
Supporter
Level 19
Blank Slate
Response to Best Language for Maths? 2004-09-14 09:31:24 Reply

At 9/14/04 06:02 AM, Wonderer wrote: what the hell is this about?
lol

Look you asshole.
This is lkike the 3rd time you come randomly and ask "LOL WHAT IS THIS ABOUT?"
If you don't know what programming is, please go away as this is the PROGRAMMING forum.


BBS Signature
Amish
Amish
  • Member since: Mar. 13, 2003
  • Offline.
Forum Stats
Member
Level 16
Blank Slate
Response to Best Language for Maths? 2004-09-14 15:14:16 Reply

Yeah what f13 siad. IN short and sweet.

Stop spamming. And go away

bumcheekcity
bumcheekcity
  • Member since: Jan. 19, 2003
  • Offline.
Forum Stats
Member
Level 27
Blank Slate
Response to Best Language for Maths? 2004-09-14 16:39:47 Reply

I've had the same password for ABSOLUTELY EVERYTHING for AGES now... And now I gotta change it for NG. *Shrugs* Either way, thanks, Earfetish.

liljim
liljim
  • Member since: Dec. 16, 1999
  • Offline.
Forum Stats
Staff
Level 28
Blank Slate
Response to Best Language for Maths? 2004-09-14 18:02:55 Reply

At 9/12/04 12:33 PM, bumcheekcity wrote: a LOT faster than PHP and mySQL seem to be doing it, which is currently 'bloody slow'

I'm not surprised it's going slow, with over 120,000 queries per execution. Give us some examples of the data in your tables and where they should match - I wouldn't be questioning the speed of php/mysql in all of this, I'd first look into your own logic. I'm willing to bet there's probably a way of getting all of those queries down to just one (or, at the very most, a few).

CronoMan
CronoMan
  • Member since: Jul. 19, 2004
  • Offline.
Forum Stats
Member
Level 06
Blank Slate
Response to Best Language for Maths? 2004-09-15 02:53:21 Reply

At 9/12/04 12:33 PM, bumcheekcity wrote:

:blah blah bla...Bearing in mind that I use PHP and ASP most of the time, i'm looking for something to calculate things like this:

Why the fuck are you using a server-side scripting language for maths? Probably the stupidest thing I've ever seen.

For maths only, try Mathematica.


"no sound in ass"