how can we use math .pi without using impot java.lang.Math*; PROGRAMING LANG:- JAVA |
+0 forum
2 | ||

Code Snippet
Plot a Valantine's heart on your screen There are many pictures of hearts out there. I just wanted to draw a picture of a heart on my own from a math formula I found on the net. Seems there are many formulas to find. This is how it looks: ![Heart.PNG](/attachments/small/1/4c36fe9d031a39f8b3468f1c4f8a8f3d.PNG "align-left") Enjoy! |
+3 forum
0 | ||

I'm using this snippet to calculate the sum of two table cells. var sum = 0; $('.amount').each(function(){ sum += parseFloat($(this).text()); }); $('.sum').text(sum); But when the sum is for example 40.00 it displays as 40 and as picky as I am, i want it to display as 40.00. So... what to do? Little (editable) demo: https://codepen.io/gentlemedia/pen/gGXJgR |
+1 forum
1 | ||

Code Snippet
Horner polynomial evaluation Short snippet in C# to do this classic trick, I could not find one on the web. Little, (even none!) error checking is done here. |
+0 forum
3 | ||

Have you ever wanted to develop a math parser and evaluator? Are you in such a quandary or just have curiosity or interest in the matter? If so, you may download the complete source version 8.3.48 or later, but be warned there is almost no comment; or instead, follow versions v8.4.x which will be more digest and, of course, all the source code for each new v8.4.x will be there, if you wish, to download. Currently, v8.4.0 does simple arithmetic but contains the main classes and algorithms that hold all the rest. Version 8.4.0 has been developed entirely under MS … |
+0 forum
22 | ||

Hello everyone, I am posting this more generically in the software development section to see what might be available and to increase a possible success rate. But enough of that let's get to the question at hand. Recently, in C#, I started back up a project of mine to do RSA encryption. Part of what makes an RSA cipher successful is the production of large, random numbers, that are prime. For my project, I am using a library that uses random.org to seed a random number generator, and then producing VERY large values that must be stored in BigIntegers (for … |
+0 forum
15 | ||

Sorry for the vague title, but I'm using a PHP snippet on a WooCommerce shop which shows the difference between an old price and a new price (sale price) in a percentage bubble on the page. The thing is it shows also percentages with decimals behind a comma if it's not a round number. I would like to have it without the comma and decimals, so that it always shows a round number. How would I alter this in the below script? There are 2 variations in it by the way. One is for a single price and the other … |
+0 forum
5 | ||

One of the most, if not THE most, beautiful formulas in math, is from Euler: ![Euler_e_pi_i.png](/attachments/large/1/b32f45540a27b3efc328d14c60ee286c.png "align-center") It combines in it a relation between the number **e**, the number **Pi** and the complex number **i**, plus the basic math symbols 1, +, = and zero. Is that not amazing? More info on this formula can be found [here](https://en.wikipedia.org/wiki/Euler's_formula). The Complex type in C# is available as of .NET v4.0 and lives in the System.Numerics namespace. As this type is not used on a regular basis it is not included as reference in every project by default. So you have to … |
+1 forum
7 | ||

For my own use, I'd like to develop a small Vector and a Matrix class, independent of some big libraries that exist out there. My question is: Should Vector and Matrix stay two independent entities or should I derive a Vctor frm a Matrix or a Matrix from a Vector? Any response is as always greatly appreciated. :) |
+0 forum
9 | ||

Code Snippet
Training passing ten in addition and substraction Python helps in real life situation to automate things. This program helps you to prep up your kids ability to go over/under ten, which is essential not only by itself, but also when calculating with bigger numbers. Program is not any special, but shows how useful Python can be in real life situations. |
+0 forum
2 | ||

Code Snippet
Degrees to Radians The .Net Framework uses by default radians in its trigonometry calculations. Find out how to convert degrees to radians to use with C# |
+1 forum
5 | ||

Hello. I need to write a program to evaluate a definite integral with Simpson's composite rule. 1. ![fb9ac9a01f247c8a0ed8a606b7c10f4a](/attachments/small/4/fb9ac9a01f247c8a0ed8a606b7c10f4a.png "align-left") I know there is a Simpson's rule available in Scipy, but I really need to write it by the following scheme. 2. ![239643044a08379e5fe3747e13b2834e](/attachments/small/4/239643044a08379e5fe3747e13b2834e.png "align-left") , where a, b - limits of integral, n-number of intervals of integral's partition. 3. ![0cf9e68f1b97018bfe85f73ce9d006d4](/attachments/small/4/0cf9e68f1b97018bfe85f73ce9d006d4.png "align-left") for k-even and 4. ![d70ba8084b9c3e425415268bf2a2903e](/attachments/small/4/d70ba8084b9c3e425415268bf2a2903e.png "align-left") for k-uneven I already got this far (see below), but my answer is not correct. The output of my code is equal 0.07. But answer of WolphramAlpha that uses identical algorithm is 0.439818. [Click … |
+0 forum
7 | ||

Code Snippet
Simulating NORMDIST function of Excel in C# Well, there was a thread about a frequency function and a bell curve in Excel. [url]http://www.daniweb.com/forums/thread295203.html[/url] So here it is how about to do the NORMDIST function in Excel in C#. |
+0 forum
2 | ||

Code Snippet
C#: Implementing polynomials with the Tuple class Don’t know if this is ever been done before, or even if it is a good way to do it. I’ll just await your comments if any. What I mostly found on the web is that if you want to define a polynomial you need to have an array containing the coefficients. The place of the coefficient in the array determines the power of the unknown, you have to include a 0(zero) in the array for the powers that are not in your polynomial. So I tried to do it using a list of tuples, with one element containing the … |
+0 forum
0 | ||

Hi, in my polynomial class all the terms consist of a List of tuples (double, uint), representing the coefficient and the exponent; a real and a natural number. The +operator implementation works great, but I was wondering if I could avoid to write two times `grouping.Sum(s => s.Item1)` It somehow feels not good, but I can't seem find a way to circumvent it. If any LINQ guru out there, could provide me with a helping hand that would be nice! :) Here is the code: public static tuplePolynomial operator +(tuplePolynomial tp1, tuplePolynomial tp2) { tuplePolynomial Result = new tuplePolynomial(); Result.Terms … |
+0 forum
2 | ||

Hi there, I'm a real newbie to python so sorry if this is a stupid question or if I don't fully get your answer, no hate please! I'm trying to write a small program to use when calculating differential equations bu using Euler's step method, don't worry if you don't know what that is, it's not important. My code looks like this: #!/usr/bin/python3.3 -tt import sys def main(): x = float(input("Ange x - värde: ")) y = float(input("Ange y - värde: ")) print ("(",x,",",y,")") h = float(input("Ange steglängd: ")) limit = float(input("Till vilket x - värde önskas gå: ")) while … |
+0 forum
4 | ||

So I have a button which adds a "Miner" then removes the cost of the Miner. The problem is that it is taking away too much, double the cost, and also will not buy if the current gold is equal to the cost. I have no idea why it is like this because I know I didn't program it like this. Here is an Example Scenario: hasEnoughGold, returns boolean (On Exact Amount) hasEnoughGold, returns boolean (One gold more then Cost) miner.getCost(), returns int Calculation (game.getCurGold() - miner.getCost() = game.getCurGold()) game.getCurGold(), returns double false true 25 Calc: 26.0 - 25.0 = … |
+0 forum
1 | ||

I have a query that starts like this... SELECT COUNT(A.FISH), COUNT(B.MEAT), COUNT(C.FRUIT).... now my problem is this, how could I count when I need to consider an expiration date for each column,...and the expiration dates varies for each column... Can I do this in one query? Or is there any other way I can do to consider the dates for each column?????..... Need clarification here... Thank you in advance.... |
+0 forum
2 | ||

I need help with this: -write an application to perform simple arithmetic operations on integers. Specification 1.Name the .java file SimpleMath 2.The program should do the following: ◦Prompt the user to enter five integer values from the keyboard. ◦Display the sum and average of the numbers. ◦Display the quotient of the first number divided by the second. ◦Display the remainder of the fourth number divided by the fifth. NOTE:The average calculation should result in the integer representation of the average, not the decimal valu |
+0 forum
0 | ||

I have looked around on the internet a little bit, but I am unable to find a function or equation for inverse/arcsine. I was able to find Inverse Cosine, but inverse sin doesn't seem to exist. Does anyone know how to use inverse sine in delphi? |
+0 forum
9 | ||

I'm creating a table with PHP/MySql to enter local election results from my newspaper, I'm not a professional developer, more of just a hobbiest hack (who hasn't worked with PHP for a few years either), so feel free to correct existing code if you so please. What I want to do is to list vote totals for each precinct, and then have PHP total those totals. So, the way the data base would be set up is Race ID, Candidate Name, and each available precinct's totals. This is my current code to return one of the tables. What I would … |
+0 forum
20 | ||

Hi , I am trying to do a couple of bitwise operations on some hex numbers but for some reason i cant compile. Apparently, it wont be possible with my method: #include <stdio.h> float tv,lv; float nv = 0x01FE; int main() { tv = 0x7FFC; lv = 0x8000 & tv; printf("lv = %.02f\n", lv); if (lv == 0x8000) { // number is negative lv = 0x0000; printf("lv has been changed to zero"); } else { lv = (nv / tv) * 100; printf("number is positve lv = %.02f%", lv ); } } i get this error :invalid operands to binary … |
+0 forum
7 | ||

Code Snippet
Matrix Multiplication - C++ Program Here is a small--complete--program that includes a sub-routine that inputs two matrices and then multiplies them. Notes: * 1) I happen to like taking input from a text file. It eliminates the need to type input from the console, especially when debugging, it prevents the possibility of making typos. * 2) The sub-routine includes several checks to make sure the array sizes are correct. These checks are not necessary for this particular program, but the checks were added in case the sub-routine is ever copied and used somewhere other than this program. * 3) To make the code more concise, … |
+3 forum
4 | ||

I'm sorry. These question probably sound very stupid to you people. But to me they are extremely difficult. Imagine being completely ignorant with computers, and signing up for an intermediate level class (I did not take the beginner class)................ and NEEDING an A to make up for the 2 B's I got last semester!! Lots of pressure (and I haven't even mentioned the worst part). In any case........ I need help. I appreciate those who stop to help. Thank you. This one I cannot figure out, despite adequate math skills. If it were JUST math I could probably work something … |
+0 forum
5 | ||

Hi. I need help with a program. It is a simple program where it looks for a sequence of numbers (between 1000 and 9999) where the sum of 4 sequential numbers to the 4th power = a 4 digit number comprised of those 4 original numbers. (I know... see example). Example: 1^4 + 2^4 + 3^4 +4^4 = 1234. I thought I could run a "while" loop. "While total <= 9999". Run the logic... A = 1 B = (A+1) C = (A+2) D = (A+3) I thought I could run a "while" loop. "While total <= 9999". "if" A^4 … |
+0 forum
2 | ||

Code Snippet
'Mates8': a .Net math library The days when the calculator had almost 3 thousand visits a day have gone. Since then, there have been several major versions and lots of minor versions. Somehow, I feel pleased in that the present core algorithm follows the rules of the first I read; of course, extending the simplicity of just adding or multiplying to other operations. After many unsuccessful efforts, version #8 has the ability to parse matrix expressions and, at the same time, derivatives or integration symbols. Mates8 -Spanish or Catalan equivalent to English 'math8'- perhaps isn't the quickest, nor by far the most complete math library … |
+0 forum
0 | ||

Code Snippet
Quadratic Equation Solver - C++ Sub-routine Here is my first Code Snippet contribution: a C++ sub-routine that computes the roots of a quadratic equation. Notes: * This sub-routine checks if a = 0. * IF a = 0, then the equation is actually not a quadratic equation; it is a linear equation with one--if any--root. * IF the user misses the output statement alerting the user to this fact, the second root has been explicitly assigend a NaN value so that the result is not mistaken for a number. |
+1 forum
10 | ||

Code Snippet
Solving the cubic equation using the Complex struct Complex numbers are seldom used in daily life, altough you could say that every real number is complex, but with the imaginary part equal to zero. And btw. "complex" is a bit of a misnomer, perhaps we should call them "easies", because often they make it easier to perform certain math tasks. It all started in Italy, 13th century or so when mathematicians where trying to solve quadratic and cubic equations. Here is my solution in C# of the cubic. I used the rules found in wikipedia. Included a zip file with a small formsapplication that exercises the method given … |
+0 forum
2 | ||

I was in the library's multimedia room to do my assignment, but all PCs don't have Visual Studio and other smiliar programs. So I wrtie the code on Notepad for the question: > Design a solution that will determine and display the fewest number of ringgit and coins in change of a purchase value. The customer may pay any amount for the purchase. The changes are in the form of 1 cent, 5 cents, 10 cents, 50 cents, RM1, RM5, RM10 and RM50. > The following is an example of the solution result. > Purchase : RM 23.63 > Payment … |
+0 forum
2 | ||

Can someone help me with this? This is part of my first assignment. I am quite new to programming. > A company wants to transmit data over the telephone, but they are concerned that their phones are tapped. All of their data are transmitted as four-digit integers. They wanted you to write a program that encrypts their data so that it can be transmitted securely. Your program should read a four-digit integer and encrypts it as follows : Add 7 to each digit and modulus 10. Then swap the first with the third and the second with the fourth. Lastly, … |
+0 forum
3 |

The End.