# Search results

1. ### Mathematica What is ___ vs _ in Mathematica ?

Hi guys , I have the next declaration in Mathematica : myfunc [lis_list] and myfync [x_,y___] what does "lis_list" means ? I know that when I want to declare a variable of a function I must write myfunc[SomeVar_] with one _ but what are 3 times _ (meaning ___) I hope...
2. ### Mathematica Functions in Mathematica - sort function

Thank you . This would do ? sort[list_] := For[i = 1 ; i < Length[list]; i++; If [ list[i] < list[i + 1] ; j = list[i + 1] , list[i + 1] = list[i], list[i] = j; ] ?
3. ### Mathematica Functions in Mathematica - sort function

Hi , I'm trying to write down the following function : sort[list_] it needs to sort a list of numbers by checking each two adjacent numbers and swap them if it is needed , but it doesn't work . I need to implement it using Pattern Matching . but I don't understand how can I...
4. ### Mathematica A few questions in Mathematica

Hi , I'm trying to solve the following equation: e^x=x^3 + x^2 -1/4* x -4 using this code : NSolve[Exp[x] = x^3 + x^2 - 0.25 * x - 4, x] but it doesn't work . In addition I'm trying to solve it graphically by plotting the left and right functions simultaneously . but how ? with...
5. ### Mathematica Can someone please explain how to write functions in Wolfram Mathematica ?

I'm good in writing functions in Matlab , however since moving to Mathematica , I find it pretty hard to write them . For instance I need to write a function that returns a [1,0,-1] to integers, meaning x>0 , x==0 , x<0 with a single If , but I didn't find a way with one (only two)...
6. ### Mathematica Mathematica functions

Hi guys , I'm a little new with Mathematica and I'm trying to write down some functions. the first one is writing a functions that square the elements in a vector , recursively , using patterns . so , I tried this one : x = Range[1, 10]; sq[0,list_]=list^2; sq[sum_,list_] :=...

Hi all , I'd like your help with some actions taken with matrices . if A=[1 2 3 ; 4 5 6 ; 7 8 9 ] and C=[1 3 -1 ; 2 4 0 ; 6 0 1 ] what is the difference between A/C and A\C ? what does it mean A./A ? what is A. ? matlab doesn't give me an answer when I write A. thanx
8. ### MATLAB What is A. in Matlab ?

Hi guys , When I say A= [3 6 1 9] ; what does it mean about A ? thanks
9. ### MATLAB A problem in Matlab ,code doesn't work

for example , when I type in Matlab the following input : simp('sin',0,pi/3,40)+simp('cos',0,pi/3,40) sin suppose to be used , but it doesn't . It says : "??? Error using ==> sin Not enough input arguments. " "Error in ==> integral=integral+4*eval(f); "
10. ### MATLAB A problem in Matlab ,code doesn't work

Hi guys , I need to write a code in order to calculate Simpson's Rule. Here is my code , what's wrong with it ? function [integral]=simp(f,a,b,n) if mod(n,2)~=0 warning('n must be even!') else h=(b-a)/n; integral=0; for i=1:1:n-1 x=a+i*h...
11. ### MATLAB Problem with drawing a function in MATLAB

hi guys , I'm trying to draw the following function , however MATLAB doesn't like my code . What am I doing wrong ? z = x + (y – 100)^2 where x = -50 : 50, y = 0 : 200 my code : [x,y]=meshgrid(-50:1:50,-0:1:200) surf(x , y , x. + (y.-100)^2) thank you