Message Boards Message Boards

1
|
14725 Views
|
17 Replies
|
18 Total Likes
View groups...
Share
Share this post:

Problems with ArcSin[], FindRoot[], invisible characters, new discussions

Posted 10 years ago
Hi,

If I run a code with sin(ArcSin) imbeded in it , the output I am getting is ;
if x=1(say)
sin(ArcSin[1]),instead of a numerical values,i.e. 1.

NOTE: I tried running, sin(ArcSin[1]) independently ; I do get 1.

I am confused, such a silly thingĀ  but its a bug I cant fix in my program.

A help will be appreciated.

Hope to hear back soon

SD
Attachments:
POSTED BY: S D
17 Replies
Posted 10 years ago

When I read your post six days ago it was not clear exactly what the question was, "I have a bunch of numbers and they are wrong, what should I do?"

If I only use N and do not use Re or Abs on any of your numbers to hide what the value might be in your Print it is clear that r1 is real, r2 is complex and not equal to r1, h is real, h1 is complex and not equal to h and Energy is complex. Each of those seems to contradict what you say the results must be. Perhaps, if you are lucky, there is only one small, simple, easy to find and fix error. Hopefully it is not that every calculation has several different and very hard to find errors.

Rather than printing out a list of 30 incorrect results, can you choose a single value for h1, carefully think what the result should be for that value of h1, perhaps plot the function you are using FindRoot on and see if it is finding the wrong root? Or see if there is some other error in what is being given to FindRoot? Or is the equation for Energy perhaps incorrect? The idea is to focus on a small problem and try to discover and correct any error in that. If that works then you can see whether this gives the correct answer for your long list of results.

I don't even know where to begin to try to decide whether there is an error in your Energy equation or in the FindRoot equation.

POSTED BY: Bill Simpson
Posted 10 years ago

Any Suggestion?

POSTED BY: S D
Posted 10 years ago
Attachments:
POSTED BY: S D
Posted 10 years ago
POSTED BY: Bill Simpson
Posted 10 years ago

Bill ,

Thanks a lot for your help , i am a beginner , so i am getting stuck a lot ... If you dont mind I am having this problem , but i am not sure how to fix it ..attached

Attachments:
POSTED BY: S D
Posted 10 years ago
Attachments:
POSTED BY: Bill Simpson
Posted 10 years ago

I am having trouble with findroot too , if anyone can help me out !, see attached

Attachments:
POSTED BY: S D
Posted 10 years ago

Hey all, I am stuck with using a findroot in a for loop , i have attached a simple example , please help ! SD

Attachments:
POSTED BY: S D
Posted 10 years ago

Try this

a = 5;
b = 6;
For[c = 1, c < 10, c = c + 1, 
 Print[Plot[a*x^2 + b*x + c, {x, -1, -.2}, AxesOrigin -> {0, 0}]];
 Print[Expand[Reduce[a*x^2 + b*x + c == 0, x]]];
 Print["{x,c,x+c}=", {x, c, x + c} /. FindRoot[a*x^2 + b*x + c == 0, {x, 0}]]
]
POSTED BY: Bill Simpson
Posted 10 years ago
h22 solve.nb has TagBoxes and ToolTipBoxes and Subscripts buried in there.

Try this and see if I haven't damaged too much.
Attachments:
POSTED BY: Bill Simpson
Posted 10 years ago
Please Ignore the subject line, I am having trouble creating a new discusiion. Anyways, I have attached a file , I am having trouble finding a solution using NSolveĀ  Please help me find a way to find a solution .. thanks
Attachments:
POSTED BY: S D
Posted 10 years ago
I'm not sure what is causing it, but you are getting things like this
, InterpretationBox[Cell["", "KeyEvent"],
TextCell["", "KeyEvent"]]
in your notebooks. That is what is keeping Mathematica from seeing each of your cells as a simple numeric expression to turn into a single number.

I opened up your notebook using Notepad, looked for those, carefully deleted them, saved the notebook as Simplify2.nb (with type "all files" so that Notepad would not append a .txt onto the end of the file name. When editing that I remove the comma immediately before InterpretationBox and InterpretationBox and then CAREFULLY count opening and closing brackets to make certain I have all the arguments that are being given to it.

The edited simplify2.nb is attached.

I assume there is some combination of keystrokes and mouse clicks that is putting these in there when you are expecting something else. Perhaps someone better than I can explain can do this. But once they are in there they are completely invisible to the average user unless you know what to look for using Notepad or something similar.
Attachments:
POSTED BY: Bill Simpson
Posted 10 years ago
Also IĀ  cant create a new discussion , the group tab is not active ; anything i should know?
POSTED BY: S D
Posted 10 years ago
Hi ,
I cant get a whole number , despite using N[] or Simplify[], see attached
Attachments:
POSTED BY: S D
Posted 10 years ago
There are two invisible items in the notebook.
,InterpretationBox[Cell["", "KeyEvent"], TextCell["", "KeyEvent"]]
I CAREFULLY manually removed those with a text editor.

The infinite sums don't appear to have simple solutions. Numerical approximations of finite sums have underflow problems but might help you.
Attachments:
POSTED BY: Bill Simpson
Posted 10 years ago
Hey , I am having trouble with the sum. Attached is the file.
Thanks !

SD
Attachments:
POSTED BY: S D
Posted 10 years ago
In your notebook, the "ArcSin" commands are actually "Button" functions which refers to the hyperlink "paclet:ref/ArcSin". This means if you click the button it will open the "ArcSin" help file. If you remove these button forms and write cleanly "ArcSin", you should get your output.
In[1]:= (*An example of my output*)-0.13634512116579703` \
(1.5999999999999997`*^-13 +
    9.027136667704869`*^-12 Sin[ArcSin[0.5`]] -
    2.256784166926217`*^-12 Sin[ArcSin[0.5`]]^2) -
40636.410967554446` (-3.2150029430991243`*^-11 Sin[ArcSin[0.5`]]^2 -
    2.3945580341426048`*^-17 Sin[ArcSin[0.5`]]^3)
Out[1]= 3.26615*10^-7
POSTED BY: Girish Arabale
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract