|
solve the following system:
2x1-x2=1
-xi+2xi+1=0, i=1,2,.....,n-2.
-xn-1+2xn=1.
Using a)thomas method,
b) Jacobi method,
c) SOR scheme (use w=1 (Gauss-Seidel), w=1.1, w=1.2, w=1.3, w=1.4, w=1.5).
Use intial approximation x^(0) e=10^-6. Limit the maximum number of iteration to N=500. Display the output in the following form:
Number of iteration for convergence:?
Solution:
x1=
x2=
.
x20=
|
|
|
|
|
I'm not doing your assignment for you - but Google[^] can help you find pages like this[^].
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
|
Hi
If this is your problem:
2x1-x2=1 ...................[1]
-xi+2xi+1=0, i=1,2,.....,n-2. .....[2]
-xn-1+2xn=1 ......................[3]
solution:
from [1] you get:
x(2)= 2*x(1)-1
from [3] you get:
x(n-1) = 2*x(n) -1
from [2] you get:
n= ? : rem n value should be set
for j=1 to 50
rem 50 is max iterations set to.
for i=1 to n-2
if i=2 then
x(2)= 2*x(1)-1
end if
x(i)= 2*x(i+1)
next i
x(n-1) = 2*x(n) -1
next j
Remark: I hope I understood your problem, since the solution
correctness depends on that too.
If your your problem is not stated correctly, that
belongs to you.
I hope that I helped, if you need more let me know.
|
|
|
|
|
Alright, I'm trying to have my program, which was writting in C++ using Dev-Cpp 4.9.9.2, open a separate program.
I know this can be achieved throw the use of system() but I can't seem to get it to work right, I'm currently using the command line:
system("c:\\Program Files\\Internet Explorer\\iexplorer.exe"); I get the error "'c:\Program' is not recognized as an internal or external command, operable program or batch file."
|
|
|
|
|
- It's just a command line, as passed to CMD, so put double quotes around the path as it contains spaces:
system("\"c:\\Program Files\\Internet Explorer\\iexplorer.exe\"");
- Isn't it iexplore.exe, not iexplorer.exe?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks again Stuart really appreciating all the help you're giving me. That one worked perfect on the first try. I didn't know anything about double quotes until a little bit before i posted this issue. I looked up other examples on google and when I tried it with the double quotes before it told me the same issue. But having just tested it with the line still saying iexplorer instead of iexplore it gave the error again, so it looks like that was my issue.. really need to stop doing this at 2 am..
|
|
|
|
|
The message you showed, saying that 'c:\Program' wasn't recognised, is a giveaway that you're having issues with spaces in the command-line. If you see it in the future, that's what your issue will be...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
In my VC++ 8.0 project I got the following errors:
1>d:\development\glestold\source\shared_lib\sources\graphics\interpolation.cpp(19) : fatal error C1083: Cannot open include file: 'windef.h': No such file or directory
1>d:\development\glestold\source\shared_lib\include\platform\sdl\sdl_opengl.h(32) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
I searched and found those files in the PlatformSDK folder i.e
C:\Program Files\Microsoft Platform SDK\Include folder.
I included this and the corresponding lib path in the project settings.
Now I get a punch of errors in winnt.h file in which I didn't do any modifications(system file).
The list of errors in the winnt.h file are:
1>------ Rebuild All started: Project: GlestLib, Configuration: Debug Win32 ------
1>Deleting intermediate and output files for project 'GlestLib', configuration 'Debug|Win32'
1>Compiling...
1>stdafx.cpp
1>Compiling...
1>buffer.cpp
1>camera.cpp
1>context.cpp
1>font.cpp
1>font_manager.cpp
1>graphics_interface.cpp
1>interpolation.cpp
1>c:\program files\microsoft platform sdk\include\winnt.h(3857) : error C2146: syntax error : missing ';' before identifier 'ContextRecord'
1>c:\program files\microsoft platform sdk\include\winnt.h(3857) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft platform sdk\include\winnt.h(3857) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft platform sdk\include\winnt.h(8319) : error C2065: 'PCONTEXT' : undeclared identifier
1>c:\program files\microsoft platform sdk\include\winnt.h(8320) : error C2146: syntax error : missing ')' before identifier 'ContextRecord'
1>c:\program files\microsoft platform sdk\include\winnt.h(8320) : warning C4229: anachronism used : modifiers on data are ignored
1>c:\program files\microsoft platform sdk\include\winnt.h(8320) : error C2182: 'RtlCaptureContext' : illegal use of type 'void'
1>c:\program files\microsoft platform sdk\include\winnt.h(8320) : error C2491: 'RtlCaptureContext' : definition of dllimport data not allowed
1>c:\program files\microsoft platform sdk\include\winnt.h(8320) : error C2059: syntax error : ')'
1>c:\program files\microsoft platform sdk\include\winnt.h(9594) : error C3861: '__readfsdword': identifier not found
1>model.cpp
1>model_manager.cpp
1>particle.cpp
1>pixmap.cpp
1>c:\program files\microsoft platform sdk\include\winnt.h(3857) : error C2146: syntax error : missing ';' before identifier 'ContextRecord'
1>c:\program files\microsoft platform sdk\include\winnt.h(3857) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft platform sdk\include\winnt.h(3857) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft platform sdk\include\winnt.h(8319) : error C2065: 'PCONTEXT' : undeclared identifier
1>c:\program files\microsoft platform sdk\include\winnt.h(8320) : error C2146: syntax error : missing ')' before identifier 'ContextRecord'
1>c:\program files\microsoft platform sdk\include\winnt.h(8320) : warning C4229: anachronism used : modifiers on data are ignored
1>c:\program files\microsoft platform sdk\include\winnt.h(8320) : error C2182: 'RtlCaptureContext' : illegal use of type 'void'
1>c:\program files\microsoft platform sdk\include\winnt.h(8320) : error C2491: 'RtlCaptureContext' : definition of dllimport data not allowed
1>c:\program files\microsoft platform sdk\include\winnt.h(8320) : error C2059: syntax error : ')'
1>c:\program files\microsoft platform sdk\include\winnt.h(9594) : error C3861: '__readfsdword': identifier not found
1>quaternion.cpp
1>shader.cpp
1>shader_manager.cpp
1>texture.cpp
1>texture_manager.cpp
1>context_gl.cpp
1>font_gl.cpp
1>model_renderer_gl.cpp
1>opengl.cpp
1>Generating Code...
1>Compiling...
1>particle_renderer_gl.cpp
1>shader_gl.cpp
1>d:\development\glestold\source\shared_lib\include\graphics\gl\shader_gl.h(98) : warning C4250: 'Shared::Graphics::Gl::VertexShaderGl' : inherits 'Shared::Graphics::Gl::ShaderGl::Shared::Graphics::Gl::ShaderGl::end' via dominance
1> d:\development\glestold\source\shared_lib\include\graphics\gl\shader_gl.h(88) : see declaration of 'Shared::Graphics::Gl::ShaderGl::end'
1>d:\development\glestold\source\shared_lib\include\graphics\gl\shader_gl.h(98) : warning C4250: 'Shared::Graphics::Gl::VertexShaderGl' : inherits 'Shared::Graphics::Gl::ShaderGl::Shared::Graphics::Gl::ShaderGl::load' via dominance
1> d:\development\glestold\source\shared_lib\include\graphics\gl\shader_gl.h(86) : see declaration of 'Shared::Graphics::Gl::ShaderGl::load'
1>d:\development\glestold\source\shared_lib\include\graphics\gl\shader_gl.h(98) : warning C4250: 'Shared::Graphics::Gl::VertexShaderGl' : inherits 'Shared::Graphics::Gl::ShaderGl::Shared::Graphics::Gl::ShaderGl::compile' via dominance
1> d:\development\glestold\source\shared_lib\include\graphics\gl\shader_gl.h(87) : see declaration of 'Shared::Graphics::Gl::ShaderGl::compile'
1>d:\development\glestold\source\shared_lib\include\graphics\gl\shader_gl.h(107) : warning C4250: 'Shared::Graphics::Gl::FragmentShaderGl' : inherits 'Shared::Graphics::Gl::ShaderGl::Shared::Graphics::Gl::ShaderGl::end' via dominance
1> d:\development\glestold\source\shared_lib\include\graphics\gl\shader_gl.h(88) : see declaration of 'Shared::Graphics::Gl::ShaderGl::end'
1>d:\development\glestold\source\shared_lib\include\graphics\gl\shader_gl.h(107) : warning C4250: 'Shared::Graphics::Gl::FragmentShaderGl' : inherits 'Shared::Graphics::Gl::ShaderGl::Shared::Graphics::Gl::ShaderGl::load' via dominance
1> d:\development\glestold\source\shared_lib\include\graphics\gl\shader_gl.h(86) : see declaration of 'Shared::Graphics::Gl::ShaderGl::load'
1>d:\development\glestold\source\shared_lib\include\graphics\gl\shader_gl.h(107) : warning C4250: 'Shared::Graphics::Gl::FragmentShaderGl' : inherits 'Shared::Graphics::Gl::ShaderGl::Shared::Graphics::Gl::ShaderGl::compile' via dominance
1> d:\development\glestold\source\shared_lib\include\graphics\gl\shader_gl.h(87) : see declaration of 'Shared::Graphics::Gl::ShaderGl::compile'
1>text_renderer_gl.cpp
1>texture_gl.cpp
1>factory_repository.cpp
1>gl_wrap.cpp
1>platform_menu.cpp
1>platform_util.cpp
1>d:\development\glestold\source\shared_lib\sources\platform\sdl\platform_util.cpp(14) : fatal error C1083: Cannot open include file: 'glob.h': No such file or directory
1>socket.cpp
1>d:\development\glestold\source\shared_lib\sources\platform\posix\socket.cpp(69) : error C2511: 'Shared::Platform::Socket::Socket(int)' : overloaded member function not found in 'Shared::Platform::Socket'
1> d:\development\glestold\source\shared_lib\include\platform\win32\socket.h(43) : see declaration of 'Shared::Platform::Socket'
1>d:\development\glestold\source\shared_lib\sources\platform\posix\socket.cpp(81) : error C2039: 'close' : is not a member of '`global namespace''
1>d:\development\glestold\source\shared_lib\sources\platform\posix\socket.cpp(81) : error C3861: 'close': identifier not found
1>d:\development\glestold\source\shared_lib\sources\platform\posix\socket.cpp(89) : error C3861: 'ioctl': identifier not found
1>d:\development\glestold\source\shared_lib\sources\platform\posix\socket.cpp(99) : error C2065: 'ssize_t' : undeclared identifier
1>d:\development\glestold\source\shared_lib\sources\platform\posix\socket.cpp(99) : error C2146: syntax error : missing ';' before identifier 'bytesSent'
1>d:\development\glestold\source\shared_lib\sources\platform\posix\socket.cpp(99) : error C2065: 'bytesSent' : undeclared identifier
1>d:\development\glestold\source\shared_lib\sources\platform\posix\socket.cpp(107) : error C2146: syntax error : missing ';' before identifier 'bytesReceived'
1>d:\development\glestold\source\shared_lib\sources\platform\posix\socket.cpp(107) : error C2065: 'bytesReceived' : undeclared identifier
1>d:\development\glestold\source\shared_lib\sources\platform\posix\socket.cpp(115) : error C2146: syntax error : missing ';' before identifier 'err'
1>d:\development\glestold\source\shared_lib\sources\platform\posix\socket.cpp(115) : error C2065: 'err' : undeclared identifier
1>d:\development\glestold\source\shared_lib\sources\platform\posix\socket.cpp(124) : error C2065: 'F_SETFL' : undeclared identifier
1>d:\development\glestold\source\shared_lib\sources\platform\posix\socket.cpp(124) : error C2065: 'O_NONBLOCK' : undeclared identifier
1>d:\development\glestold\source\shared_lib\sources\platform\posix\socket.cpp(124) : error C3861: 'fcntl': identifier not found
1>d:\development\glestold\source\shared_lib\sources\platform\posix\socket.cpp(243) : error C2664: 'setsockopt' : cannot convert parameter 4 from 'int *' to 'const char *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>thread.cpp
1>window.cpp
1>window_gl.cpp
1>sound.cpp
1>sound_file_loader.cpp
1>sound_interface.cpp
1>sound_player.cpp
1>checksum.cpp
1>conversion.cpp
1>leak_dumper.cpp
1>profiler.cpp
1>Generating Code...
1>Compiling...
1>properties.cpp
1>random.cpp
1>util.cpp
1>xml_parser.cpp
1>Generating Code...
1>Build log was saved at "file://d:\Development\GlestOld\GlestLib\Debug\BuildLog.htm"
1>GlestLib - 34 error(s), 8 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
How do I get around these errors?
I've already posted this in this forum at the following link:
http://www.codeproject.com/script/Forums/View.aspx?fid=1647&df=90&mpp=25&noise=3&sort=Position&view=Quick&fr=401#xx0xx[^]
The reason for reposting is, I couldn't reply to the members queries since I was on leave. Please help me.
|
|
|
|
|
trying doing "#include<windows>" and "#include<windef>"
When I first started using Microsoft Visual Studio 2008 I kept having issues in regards to using the .h or not. Online tutorials and some books would tell me that most if not all include files had to have the .h but my compiler would only work when they didn't. So, it might work, it might not. </windef></windows>
|
|
|
|
|
<blockquote class="FQ"><div class="FQA">gamefreak2291 wrote:</div>trying doing "#include<windows>" and "#include<windef>"</blockquote>
I changed the #include statements as you said: But it's not working. What else can be done? I've installed the Microsoft Platform SDK. Is it the suitable one for Visual C++ 2005. If not can u tell me the correct version?
|
|
|
|
|
Hello,
please help me to write a function rotate that will rotate the rectangle 45 degrees each time button is pressed
let say that rectangle values are as follows
rectangle[0].x=250.0;
rectangle[0].y=100.0;
rectangle[1].x=550.0;
rectangle[1].y=100.0;
rectangle[2].x=550.0;
rectangle[2].y=300.0;
rectangle[3].x=250.0;
rectangle[3].y=300.0;
i know that it should be something like
H2 = H·cosθ + W·sinθ
W2 = H·sinθ + W·cosθ
where H2 is the height of the rotated rectangles and W2 is the width.
i need an assistance in writing this function.. please help
|
|
|
|
|
1. Decide what point is to be the centre of rotation. Let's call it O, with co-ordinates (Xo, Yo).
2. Rotate each point of the rectangle, Pi, with co-ordinates (Xi, Yi), around O, producing a new point, Pi', with co-ordinates (Xi', Yi'). You do this using the following two identities:
Xi' = (Xi-Xo)cosθ - (Yi-Yo)sinθ
Yi' = (Xi-Xo)sinθ + (Yi-Yo)cosθ
You now have your rotated rectangle!
This page[^] may help.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
umm what i have in my code is something like:
px = (rectwidth/2); py = (rectheight/2);
so i assume that they represent my center through which i want to rotate my rectangle (px, py)
however, i am not sure how to represent all of the point of the rect to be Xi Yi
considering that my rectangle representaion is as mentioned in the previous post with co-ordinates of
(250, 100) is rectangle[0]
(550, 100) is rectangle[1]
(550, 300) is rectangle[2]
(250, 300) is rectangle[3]
i am new to C++ so i am having trouble seeing how your equasion can be programmed. i do understand the equasions u've provided though.
Please any suggestions on the programming?
like:
void rotate (float angle)
{
? = (? - px)cos(angle) - (? - py)sin(angle);
? = (? - px)sin(angle) + (? - py)cos(angle);
}
not sure what should be in there.
|
|
|
|
|
OK - for 'Pi', read 'rectangle[i]', for i in the range 0 to 3.
So, for rectangle, assuming you're transforming rectangle into a new rectangle, rectangleNew:
void rotate (float angle)
{
rectangleNew[0].x = (rectangle[0].x - px) * cos(angle) - (rectangle[0].y - py) * sin(angle);
rectangleNew[0].y = (rectangle[0].x - px) * sin(angle) + (rectangle[0].y - py) * cos(angle);
rectangleNew[1].x = (rectangle[1].x - px) * cos(angle) - (rectangle[1].y - py) * sin(angle);
rectangleNew[1].y = (rectangle[1].x - px) * sin(angle) + (rectangle[1].y - py) * cos(angle);
rectangleNew[2].x = (rectangle[2].x - px) * cos(angle) - (rectangle[2].y - py) * sin(angle);
rectangleNew[2].y = (rectangle[2].x - px) * sin(angle) + (rectangle[2].y - py) * cos(angle);
rectangleNew[3].x = (rectangle[3].x - px) * cos(angle) - (rectangle[3].y - py) * sin(angle);
rectangleNew[3].y = (rectangle[3].x - px) * sin(angle) + (rectangle[3].y - py) * cos(angle);
}
Don't try and rotate points in-place...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
If you want to see a VERY well written (I'm biased) article which has a lot of transformation work with matrices, look at:
Warping Coordinates with Matrices[^]
I like to think my diagrams will help you also.
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
I've been trying to use the Synthesis Toolkit (Found here, for those unfamiliar: http://ccrma.stanford.edu/software/stk/ ) The instructions to use it on the site seem rather vague, at best. I've downloaded DirectX 9, and added a slew of libraries to link with, and now I have some unresolved external symbols. I'm not sure how to go about tackling these messages, and am not sure what could be causing it, or what could be missing. It looks to me like a missing function in RtApiDs, but I don't know where this class is. If anyone has any experience setting up the STK for Visual Studio 2005, guidance would be greatly appreciated.
These are the four error messages I am getting:
1>RtAudio.obj : error LNK2019: unresolved external symbol _DirectSoundCaptureEnumerateA@8 referenced in function "public: virtual unsigned int __thiscall RtApiDs::getDefaultInputDevice(void)" (?getDefaultInputDevice@RtApiDs@@UAEIXZ)
1>RtAudio.obj : error LNK2019: unresolved external symbol _DirectSoundEnumerateA@8 referenced in function "public: virtual unsigned int __thiscall RtApiDs::getDefaultInputDevice(void)" (?getDefaultInputDevice@RtApiDs@@UAEIXZ)
1>RtAudio.obj : error LNK2019: unresolved external symbol _DirectSoundCaptureCreate@12 referenced in function "public: virtual struct RtAudio::DeviceInfo __thiscall RtApiDs::getDeviceInfo(unsigned int)" (?getDeviceInfo@RtApiDs@@UAE?AUDeviceInfo@RtAudio@@I@Z)
1>RtAudio.obj : error LNK2019: unresolved external symbol _DirectSoundCreate@12 referenced in function "public: virtual struct RtAudio::DeviceInfo __thiscall RtApiDs::getDeviceInfo(unsigned int)" (?getDeviceInfo@RtApiDs@@UAE?AUDeviceInfo@RtAudio@@I@Z)
And here is the list of libraries I am linking with:
odbc32.lib
odbccp32.lib
dinput8.lib
dsound.lib
dxguid.lib
winmm.lib
Wsock32.lib
gdi32.lib
User32.lib
Advapi32.lib
Inherited Values:
kernel32.lib
user32.lib
gdi32.lib
winspool.lib
comdlg32.lib
advapi32.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
odbc32.lib
odbccp32.lib
*Edit: Edited the title of the post because this looks as if it is a DirectSound issue.
modified on Monday, March 30, 2009 7:35 PM
|
|
|
|
|
Hi, is it possible to get process IDs for the current user only... or alternatively from a process ID (PID) get the owner?
I tried using CreateToolhelp32Snapshot, this gives back processes from all users. When two different users have started an executable "test.exe" at the same time I'd like to find the PID of the "test.exe" from the current user.
Thanks!
|
|
|
|
|
Could this[^] help?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
I couldn't make it to compile, but it helped to find other examples! Thanks
Surprising that it is that much work, my implementation takes a PID and uses: OpenProcess() -> OpenProcessToken() -> GetTokenInformation() -> LookupAccountSid() . It converts the SID into a string of the format "domain\user". To filter processes of the current user I first I get the owner with help of GetCurrentProcessId() and then compare it with process information from CreateToolhelp32Snapshot() . WinAPI doesn't make it too easy.
|
|
|
|
|
Well, you know what they say, "The easy road is not worth taking" (Whoever said that was not a coder for sure...).
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Hello! I'm writing a driver, which should start an application from ring0.
It is very important, that the app runs as SYSTEM account.
Finally i read alot of process creation, but I still have one problem:
After I have created section, process and thread I see my process in the taskmanager list, running as SYSTEM; but even though I Resume the thread I get following error:
0xc0000142 (STATUS_DLL_INIT_FAILURE)
But the process found the dll's, because if I renamed for e.g. msvcr80.dll I got the message that the dll, couldn't be found in my dll paths.
I read something about the kernel32.dll failing if it isn't able to access the desktop (winsta0\default).
My question now: Does anyone know what I could have made wrong, or does anyone has an idea how to solve my problem?
Greetz
Biosstar
|
|
|
|
|
Is it possible to make a standard messagebox in c++ Full screen? If so, how would I do such a thing. I'm currently including "MB_SYSTEMMODAL".
|
|
|
|
|
gamefreak2291 wrote: Is it possible to make a standard messagebox in c++ Full screen?
Nope.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
gamefreak2291 wrote: I'm currently including "MB_SYSTEMMODAL".
In an attempt to make it full screen?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|