Search Results

Search found 2155 results on 87 pages for 'mathematical expressions'.

Page 7/87 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • parsing of mathematical expressions

    - by gcc
    (in c90) (linux) input: sqrt(2 - sin(3*A/B)^2.5) + 0.5*(C*~(D) + 3.11 +B) a b /*there are values for a,b,c,d */ c d input: cos(2 - asin(3*A/B)^2.5) +cos(0.5*(C*~(D)) + 3.11 +B) a b /*there are values for a,b,c,d */ c d input: sqrt(2 - sin(3*A/B)^2.5)/(0.5*(C*~(D)) + sin(3.11) +ln(B)) /*max lenght of formula is 250 characters*/ a b /*there are values for a,b,c,d */ c /*each variable with set of floating numbers*/ d As you can see infix formula in the input depends on user. My program will take a formula and n-tuples value. Then it calculate the results for each value of a,b,c and d. If you wonder I am saying ;outcome of program is graph. /sometimes,I think i will take input and store in string. then another idea is arise " I should store formula in the struct" but i don't know how I can construct the code on the base of structure./ really, I don't know way how to store the formula in program code so that I can do my job. can you show me? /* a,b,c,d is letters cos,sin,sqrt,ln is function*/

    Read the article

  • Less Mathematical Approaches to Machine Learning?

    - by Ed
    Out of curiosity, I've been reading up a bit on the field of Machine Learning, and I'm surprised at the amount of computation and mathematics involved. One book I'm reading through uses advanced concepts such as Ring Theory and PDEs (note: the only thing I know about PDEs is that they use that funny looking character). This strikes me as odd considering that mathematics itself is a hard thing to "learn." Are there any branches of Machine Learning that use different approaches? I would think that a approaches relying more on logic, memory, construction of unfounded assumptions, and over-generalizations would be a better way to go, since that seems more like the way animals think. Animals don't (explicitly) calculate probabilities and statistics; at least as far as I know.

    Read the article

  • How to make simple mathematical operations and displaying the result in a textbox

    - by Audel
    Hi, I know is a rather simple question but I just can't find an appropriate example in google or anywhere. I've got this piece int numberOfPlays = int.Parse(textBox2.Text); numberOfPlays = (numberOfPlays++); textBox2.Text = (numberOfPlays.ToString()); MessageBox.Show(numberOfPlays.ToString()); So basically what I want to do is to get the value of the textBox2, make it an integer and then add 1 to it. I can't think of any more details right now, so if i'm not clear enough please ask Thanks in advance

    Read the article

  • How would someone implement mathematical formulae in java?

    - by Mohit Deshpande
    What I mean is like have to user input a string with multiple variables and get the value of those variable. Like a simple quadratic formula: x^2 + 5x + 10. Or in java: (Math.pow(x,2)) + (x * 5) + 10The user would then enter that and then the program would solve for x. I will be using the BeanShell Interpreter class to interpret the string as an equation. But how would I solve for x?

    Read the article

  • Why can't c# calculate exact values of mathematical functions

    - by Timo Willemsen
    Hey everyone, Why can't c# do any exact operations. Math.Pow(Math.Sqrt(2.0),2) == 2.0000000000000004 I know how doubles work, I know where the rounding error is from, I know that it's almost the correct value, and I know that you can't store infinite numbers in a finite double. But why isn't there a way that c# can calculate it exactly, while my calculator can do it. Edit It's not about my calculator, I was just giving an example: http://www.wolframalpha.com/input/?i=Sqrt%282.000000000000000000000000000000000000000000000000000000000000000000000000000000001%29%5E2 Cheers

    Read the article

  • a mathematical problem

    - by Max
    Hi i need a function that should give me a 10th or 100th array, for example if i pass 5, it should return 1 to 10 if i pass 67, it should return 1 to 100 if i pass 126, it should return 101 to 200 if i pass 2524, it should return 2001 to 3000 Any guidance?

    Read the article

  • The Numerical ‘Magic’ of Cyclic Numbers

    - by Akemi Iwaya
    If you love crunching numbers or are just a fan of awesome number ‘tricks’ to impress your friends with, then you will definitely want to have a look at cyclic numbers. Dr Tony Padilla from the University of Nottingham shows how these awesome numbers work in Numberphile’s latest video. Cyclic Numbers – Numberphile [YouTube] Want to learn more about cyclic numbers? Then make sure to visit the Wikipedia page linked below! Cyclic number [Wikipedia]     

    Read the article

  • Regular Expression HTML tags

    - by user134615
    I'd like to know whether it exists a way to put the following HTML tags in a regex. What I want is a regex that can match all the start tags with their corresponding closing tags. E.g., Hello There might be more tags inside. I had thought of something like this: ^<([a-z]+)([^<]+)(?:(.)</\1|\s+/)$/, but it wont work. Sorry if this question doesnt belong to this section. Thank you.

    Read the article

  • Regex syntax question - trying to understand

    - by Asaf Chertkoff
    i don't know if this question belong here or no, but it is worth a shot. i'm a self taught php programmer and i'm only now starting to grasp the regex stuff. i'm pretty aware of its capabilities when it is done right, but this is something i need to dive in too. so maybe someone can help me, and save me so hours of experiment. i have this string: here is the <a href="http://www.google.com" class="ttt" title="here"><img src="http://www.somewhere.com/1.png" alt="some' /></a> and there is <a href="#not">not</a> a chance... now, i need to perg_match this string and search for the a href tag that has an image in it, and replace it with the same tag with a small difference: after the title attribute inside the tag, i'll want to add a rel="here" attribute. of course, it should ignore links (a href's) that doesn't have img tag inside. help will be appreciated, thanks.

    Read the article

  • What is the best strategy for transforming unicode strings into filenames?

    - by David Cowden
    I have a bunch (thousands) of resources in an RDF/XML file. I am writing a certain subset of the resources to files -- one file for each, and I'm using the resource's title property as the file name. However, the titles are every day article, website, and blog post titles, so they contain characters unsafe for a URI (the necessary step for constructing a valid file path). I know of the Jersey UriBuilder but I can't quite get it to work for my needs as I detailed in a different question on SO. Some possibilities I have considered are: Since each resource should also have an associated URL, I could try to use the name of the file on the server. The down side of this is sometimes people don't name their content logically and I think the title of an article better reflects the content that will be in each text file. Construct a white list of valid characters and parse the string myself defining substitutions for unsafe characters. The downside of this is the result could be just as unreadable as the former solution because presumably the content creators went through a similar process when placing the files on their server. Choose a more generic naming scheme, place the title in the text file along with the other attributes, and tell my boss to live with it. So my question here is, what methods work well for dealing with a scenario where you need to construct file names out of strings with potentially unsafe characters? Is there a solution that better fills out my constraints?

    Read the article

  • How I use RegExp in my Java program? [migrated]

    - by MIH1406
    I have the following string examples: 00001 1 12 123 00002 3 7 321 00003 99 23 332 00004 192 50 912 In a separate text file. Numbers are separated by tabs not spaces. I tried to read the file and print each line if it matches a given RegExp, but I could not find the suitable RegExp for these lines. private static void readFile() { String fileName = "processes.lst"; FileReader file = null; String result = ""; try { file = new FileReader(fileName); BufferedReader reader = new BufferedReader(file); String line = null; String regEx = "[0-9]\t[0-9]\t[0-9]\t[0-9]"; while((line = reader.readLine()) != null) { if(line.matches(regEx)) { result += "\n" + line; } } } catch(Exception e) { System.out.println(e.getMessage()); } finally { if(file != null) try { file.close(); } catch(Exception e) { System.out.println(e.getMessage()); } } System.out.println(result); } I ended up without any string being printed!!

    Read the article

  • String patterns that can be used to filter and group files

    - by Louis Rhys
    One of our application filters files in certain directory, extract some data from it and export a document from the extracted data. The algorithm for extracting the data depends on the file, and so far we use regex to select the algorithm to be used, for example .*\.txt will be processed by algorithm A, foo[0-5]\.xml will be processed by algo B, etc. However now we need some files to be processed together. For example, in one case we need two files, foo.*\.xml and bar.*\.xml. Part of the information to be extracted exist in the foo file, and the other part in the bar file. Moreover, we need to make sure the wild card is compatible. For example, if there are 6 files foo1.xml foo23.xml bar1.xml bar9.xml bar23.xml foo4.xml I would expect foo1 and bar1 to be identified as a group, and foo23 and bar23 as another group. bar9 and foo4 has no pair, so they will not be treated. Now, since the filter is configured by user, we need to have a pattern that can express the above requirement. I don't think you can express meaning like above in standard regex. (foo|bar).*\.xml will match all 6 file above and we can't identify which file is paired for a particular file. Is there any standard pattern that can express it? Or any idea how to modify regex to support this, that can be implemented easily?

    Read the article

  • Regex to String generation

    - by Mifmif
    Let's say that we have a regex and an index i , if we suppose that the set of string that match our regex are sorted in a lexicographical order, how could we get the i element of this list ? Edit : I added this simple example for more explanation : input : regex="[a-c]{1,2}"; index=4; in this case the ordered list of string that matches this regex contains those elements : a aa ab ac b ba bb bc c ca cb cc output : the 4th element which is ac ps: it's known that the string list that match the regex have infinite element, this doesn't have an impact on the proccess of extracting the element in the given index.

    Read the article

  • how to speed up this code? [migrated]

    - by dot
    I have some code that's taking over 3 seconds to complete. I'm just wondering if there's a faster way to do this. I have a string with anywhere from 10 to 70 rows of data. I break it up into an array and then loop through the array to find specific patterns. $this->_data = str_replace(chr(27)," ",$this->_data,$count);//strip out esc character $this->_data = explode("\r\n", $this->_data); $detailsArray = array(); foreach ($this->_data as $details) { $pattern = '/(\s+)([0-9a-z]*)(\s+)(100\/1000T|10|1000SX|\s+)(\s*)(\|)(\s+)(\w+)(\s+)(\w+)(\s+)(\w+)(\s+)(1000FDx|10HDx|100HDx|10FDx|100FDx|\s+)(\s*)(\w+)(\s*)(\w+|\s+)(\s*)(0)/i'; if (preg_match($pattern, $details, $matches)) { array_push($detailsArray, array( 'Port' => $matches[2], 'Type' => $matches[4], 'Alert' => $matches[8], 'Enabled' => $matches[10], 'Status' => $matches[12], 'Mode' => $matches[14], 'MDIMode' => $matches[16], 'FlowCtrl' => $matches[18], 'BcastLimit' => $matches[20])); }//end if }//end for $this->_data = $detailsArray; Just wondering if you think there's a way to make it more efficient. Thanks.

    Read the article

  • Mircosoft Expressions rejecting FP extensions

    - by Moe
    Hey there, I've just moved to a new server and I can't seem to get FrontPage extensions to work with Mircosoft Expressions. I like to edit my site Live rather then local to server. But Now, when I access my domain.. eg: http://domain.com It'll come up with: Access Denied. And if I click details it returns 501 Method Not Implemented Method Not Implemented GET to / not supported. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. If I define (in .htaccess): ErrorDocument 404 /404.php The Details returns the Title and contents of 404.php. And if I define (in .htaccess): ErrorDocument 404 /404.php ErrorDocument 501 /501.php The Details return nothing. What Am I doing wrong? Thanks.

    Read the article

  • Help updating cron entry using regular expressions

    - by Uday
    hi I am trying to update a cron entry NOT by using crontab -e but by shell commands. For example the cron entry is like this: 10 * * * * /home/localuser/foo.sh -b 1 -h 4 > foo_output.sh 2>&1 No i need edit the command line parameters part ONLY i.e -b 1 -h 4 to something else which will be coming in from the user. First thing would be to write the crontab to a tmp file and then manipulate that temp file. Now, is there an easy way to edit that line using SED or something? The crude way wud be to delete that entire line, write a new line with the entire expression and then load that into the cron. I am not very good with regular expressions. My system supports sed -i so was thinking this could be done in a single line command. Thanks in advance

    Read the article

  • Visual Studio Find and Replace Regular Expressions ~ find lines with quoted strings, not containing

    - by Darkoni
    Visual Studio Find and Replace Regular Expressions Find lines with quoted strings, not containing strings include or trace i am tryling to find out all lines in c++ project that contains some text as i have to use visual studio, i have to use its Find and Replace http://www.codinghorror.com/blog/2006/07/the-visual-studio-ide-and-regular-expressions.html so, for finding all lines like: print("abc"); it is enogh to write :q and it will find all quotted strings ok, but i also get lot of lines like #include "stdio.h" and trace("* step 1 *") i find out regex to get all lines containing include and trace <include|trace> so, mine question is, how to find all lines with "quotted strings" but NOT lines that contains strings include and trace. thanx

    Read the article

  • Regular expression for Regular expressions?

    - by kavoir.com
    I have an app that enables the user to input a regular expression, my question is how to check against any input of regular expressions and make sure they are valid ones because if they are not there will be preg_match errors. I don't want to use the '@' before preg_match, so if there's a way to check the validity of the user input of regular expressions that'd be great. The regular expression system of PHP seems to be rather too complicated for me to come up with a regular expression for them. Any idea or any alternatives would be possible in achieving this?

    Read the article

  • Double interpolation of regular expressions in Perl

    - by tomdee
    I have a Perl program that stores regular expressions in configuration files. They are in the form: regex = ^/d+$ Elsewhere, the regex gets parsed from the file and stored in a variable - $regex. I then use the variable when checking the regex, e.g. $lValid = ($valuetocheck =~ /$regex/); I want to be able to include perl variables in the config file, e.g. regex = ^\d+$stored_regex$ But I can't work out how to do it. When regular expressions are parsed by Perl they get interpreted twice. First the variables are expanded, and then the the regular expression itself is parsed. What I need is a three stage process: First interpolate $regex, then interpolate the variables it contains and then parse the resulting regular expression. Both the first two interpolations need to be "regular expression aware". e.g. they should know that the string contain $ as an anchor etc... Any ideas?

    Read the article

  • Lua pattern matching vs. regular expressions

    - by harald
    hello, i'm currently learning lua. regarding pattern-matching in lua i found the following sentence in the lua documentation on lua.org: Nevertheless, pattern matching in Lua is a powerful tool and includes some features that are difficult to match with standard POSIX implementations. as i'm familiar with posix regular expressions i would like to know if there are any common samples where lua pattern matching is "better" compared to regular expression -- or did i misinterpret the sentence? and if there are any common examples: why is any of pattern-matching vs. regular expressions better suited? thanks very much, harald

    Read the article

  • lambda expressions in C#?

    - by Matt
    Hey I'm rather new to these could someone explain the significance (of the following code) or prehaps give a link to some useful information on lambda expressions? I encounter the following code in a test and I am wondering why someone would do this: foo.MyEvent += (o, e) => { fCount++; Console.WriteLine(fCount); }; foo.MyEvent -= (o, e) => { fCount++; Console.WriteLine(fCount); }; My instinct tells me it is something simple and not a mistake, but I don't know enough about these expressions to understand why this is being done. Regards,

    Read the article

  • Regular expressions in findstr

    - by Johannes Rössel
    I'm doing a little string validation with findstr and its /r flag to allow for regular expressions. In particular I'd like to validate integers. The regex ^[0-9][0-9]*$ worked fine for non-negative numbers but since I now support negative numbers as well I tried ^([1-9][0-9]*|0|-[1-9][0-9]*)$ for either positive or negative integers or zero. The regex works fine theoretically. I tested it in PowerShell and it matches what I want. However, with findstr /r /c:"^([1-9][0-9]*|0|-[1-9][0-9]*)$" it doesn't. While I know that findstr doesn't have the most advanced regex support (even below Notepad++ which is probably quite an achievement), I would have expected such simple expressions to work. Any ideas what I'm doing wrong here?

    Read the article

  • Using numeric_limits::max() in constant expressions

    - by FireAphis
    Hello, I would like to define inside a class a constant which value is the maximum possible int. Something like this: class A { ... static const int ERROR_VALUE = std::numeric_limits<int>::max(); ... } This declaration fails to compile with the following message: numeric.cpp:8: error: 'std::numeric_limits::max()' cannot appear in a constant-expression numeric.cpp:8: error: a function call cannot appear in a constant-expression I understand why this doesn't work, but two things look weird to me: It seems to me a natural decision to use the value in constant expressions. Why did the language designers decide to make max() a function thus not allowing this usage? The spec claims in 18.2.1 that For all members declared static const in the numeric_limits template, specializations shall define these values in such a way that they are usable as integral constant expressions. Doesn't it mean that I should be able to use it in my scenario and doesn't it contradict the error message? Thank you.

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >